Package 

Class Scalar

  • All Implemented Interfaces:

    
    public final class Scalar
    
                        

    An integer $s \lt 2^{255}$ which represents an element of the field $\mathbb{Z} / \ell$.

    • Constructor Detail

    • Method Detail

      • toByteArray

         final ByteArray toByteArray()

        Convert this Scalar to its underlying sequence of bytes.

      • ctEquals

         final Boolean ctEquals(Scalar other)

        Constant-time equality check.

        Compares the encodings of the two Scalars.

      • equals

         Boolean equals(Object other)

        Equality check overridden to be constant-time.

        Fails fast if the objects are of different types.

      • reduce

         final Scalar reduce()

        Reduce this Scalar modulo $\ell$.

      • add

         final Scalar add(Scalar b)

        Compute $a + b \bmod \ell$.

        If $a$ and $b$ are both canonical Scalars, the result is guaranteed to be a canonical Scalar. In all other cases, the result may be outside the range $[0, \ell)$.

        Parameters:
        b - the Scalar to add to this.
      • subtract

         final Scalar subtract(Scalar b)

        Compute $a - b \bmod \ell$.

        If $a$ and $b$ are both canonical Scalars, the result is guaranteed to be a canonical Scalar. In all other cases, the result may be outside the range $[0, \ell)$.

        Parameters:
        b - the Scalar to subtract from this.
      • multiply

         final Scalar multiply(Scalar b)

        Compute $a * b \bmod \ell$.

        Parameters:
        b - the Scalar to multiply with this.