From 52219026afc7cb07248195dd9559a9bd023851a9 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 20 Apr 2023 18:13:59 +0200 Subject: [PATCH] missing-methods: polishing ScalaDocs --- .../src/main/scala/sigmastate/crypto/CryptoContext.scala | 4 ++-- .../main/scala/sigmastate/crypto/CryptoContextJvm.scala | 1 - .../src/main/scala/sigmastate/crypto/CryptoFacade.scala | 4 ++-- .../src/main/scala/sigmastate/crypto/Platform.scala | 8 +++++--- .../src/main/scala/sigmastate/crypto/package.scala | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/interpreter/src/main/scala/sigmastate/crypto/CryptoContext.scala b/interpreter/src/main/scala/sigmastate/crypto/CryptoContext.scala index 21b5282cdd..c0190ba093 100644 --- a/interpreter/src/main/scala/sigmastate/crypto/CryptoContext.scala +++ b/interpreter/src/main/scala/sigmastate/crypto/CryptoContext.scala @@ -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. */ diff --git a/interpreter/src/main/scala/sigmastate/crypto/CryptoContextJvm.scala b/interpreter/src/main/scala/sigmastate/crypto/CryptoContextJvm.scala index 7ca4306490..7b789f1db6 100644 --- a/interpreter/src/main/scala/sigmastate/crypto/CryptoContextJvm.scala +++ b/interpreter/src/main/scala/sigmastate/crypto/CryptoContextJvm.scala @@ -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 diff --git a/interpreter/src/main/scala/sigmastate/crypto/CryptoFacade.scala b/interpreter/src/main/scala/sigmastate/crypto/CryptoFacade.scala index 87576f256d..3a53bdfa29 100644 --- a/interpreter/src/main/scala/sigmastate/crypto/CryptoFacade.scala +++ b/interpreter/src/main/scala/sigmastate/crypto/CryptoFacade.scala @@ -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 */ diff --git a/interpreter/src/main/scala/sigmastate/crypto/Platform.scala b/interpreter/src/main/scala/sigmastate/crypto/Platform.scala index db15ae729a..55bc179e54 100644 --- a/interpreter/src/main/scala/sigmastate/crypto/Platform.scala +++ b/interpreter/src/main/scala/sigmastate/crypto/Platform.scala @@ -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) @@ -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 */ @@ -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. */ diff --git a/interpreter/src/main/scala/sigmastate/crypto/package.scala b/interpreter/src/main/scala/sigmastate/crypto/package.scala index 2d6f1e8dbb..a0feb011f9 100644 --- a/interpreter/src/main/scala/sigmastate/crypto/package.scala +++ b/interpreter/src/main/scala/sigmastate/crypto/package.scala @@ -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. */