Skip to content

Commit

Permalink
missing-methods: polishing ScalaDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
aslesarenko committed Apr 20, 2023
1 parent e991c92 commit 5221902
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package sigmastate.crypto

import java.math.BigInteger

/** A context for cryptographic operations. */
/** A context for cryptographic operations over elliptic curve group. */
abstract class CryptoContext {
/** The underlying elliptic curve. */
/** The underlying elliptic curve descriptor. */
def curve: Curve

/** The characteristics of the underlying finite field. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import java.math.BigInteger
class CryptoContextJvm(x9params: X9ECParameters) extends CryptoContext {
private lazy val _curve = x9params.getCurve

/** The underlying elliptic curve. */
override def curve: Curve = Platform.Curve(_curve)

override def fieldCharacteristic: BigInteger = _curve.getField.getCharacteristic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ object CryptoFacade {
/** Returns byte representation of the given field element. */
def encodeFieldElem(p: ECFieldElem): Array[Byte] = Platform.encodeFieldElem(p)

/** Returns byte representation of the given point.
/** Byte representation of the given point.
*
* @param p point to encode
* @param compressed if true, generates a compressed point encoding
*/
def encodePoint(p: Ecp, compressed: Boolean): Array[Byte] = Platform.encodePoint(p, compressed)

/** Returns a [[Curve]] instance describing the elliptic curve of the point p
/** A [[Curve]] instance describing the elliptic curve of the point p
*
* @param p the elliptic curve point
*/
Expand Down
8 changes: 5 additions & 3 deletions interpreter/src/main/scala/sigmastate/crypto/Platform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.math.BigInteger

/** JVM specific implementation of crypto methods*/
object Platform {
/** Returns a [[Curve]] instance describing the elliptic curve of the point p
/** Description of elliptic curve of point `p` which belongs to the curve.
* @param p the elliptic curve point
*/
def getCurve(p: Ecp): Curve = Curve(p.value.getCurve)
Expand Down Expand Up @@ -51,7 +51,7 @@ object Platform {
/** Returns byte representation of the given field element. */
def encodeFieldElem(p: ECFieldElem): Array[Byte] = p.value.getEncoded

/** Returns byte representation of the given point.
/** Byte representation of the given point.
* @param p point to encode
* @param compressed if true, generates a compressed point encoding
*/
Expand Down Expand Up @@ -105,7 +105,9 @@ object Platform {
/** Negate a point. */
def negatePoint(p: Ecp): Ecp = Ecp(p.value.negate())

/** Wrapper for curve type. */
/** Wrapper for curve descriptor. Serves as the concrete implementation of the
* [[sigmastate.crypto.Curve]] type in JVM.
*/
case class Curve(private[crypto] val value: ECCurve)

/** Wrapper for point type. */
Expand Down
2 changes: 1 addition & 1 deletion interpreter/src/main/scala/sigmastate/crypto/package.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package sigmastate

package object crypto {
/** Instance of Elliptic Curve. */
/** Instance of Elliptic Curve descriptor. */
type Curve = Platform.Curve

/** Instance of Elliptic Curve point. */
Expand Down

0 comments on commit 5221902

Please sign in to comment.