CoolrfulDARkness/moonvoprf/crypto/ristretto255 does not have a README file

    RistrettoError

    pub suberror RistrettoError {
    InvalidEncoding
    InvalidScalar
    InvalidLength(Int)
    ZeroScalar
    } derive(Eq,
    Debug
    )

    Point

    pub struct Point {
    // private fields
    } derive(
    Debug
    )

    Ristretto255 group element represented internally as an extended twisted Edwards point (X, Y, Z, T) with x = X/Z, y = Y/Z, x*y = T/Z.
    impl Eq for Point

    Point::add

    fn Point::add(self : Point, other : Point) -> Point

    Complete unified twisted Edwards extended point addition (a = -1). Valid for all pairs of points including identity, doubling, and inverses.

    Point::decode

    fn Point::decode(bytes : Bytes) -> Point raise RistrettoError

    RFC 9496 §4.3.1 strict canonical decoding of a 32-byte Ristretto255 element. Rejects wrong length, non-canonical field elements (>= p), odd/negative values, non-squares, negative t, and y == 0.

    Point::encode

    fn Point::encode(self : Point) -> Bytes

    RFC 9496 §4.3.2 canonical 32-byte encoding of a Ristretto255 element (constant-time).

    Point::equals

    fn Point::equals(self : Point, other : Point) -> Bool

    RFC 9496 §4.3.3 constant-time equivalence test: X1 * Y2 == Y1 * X2 || Y1 * Y2 == X1 * X2.

    Point::from_uniform_bytes

    fn Point::from_uniform_bytes(bytes : Bytes) -> Point raise RistrettoError

    RFC 9496 §4.3.4 from_uniform_bytes: maps 64 uniform bytes to a Ristretto255 element via MAP(b[0..32]) + MAP(b[32..64]).

    Point::generator

    fn Point::generator() -> Point

    Returns the standard Ristretto255 generator (Ed25519 base point B).

    Point::hash_to_group

    fn Point::hash_to_group(msg : Bytes, dst : Bytes) -> Point raise RistrettoError

    RFC 9497 §4.1 HashToGroup(msg, DST) for ristretto255-SHA512: expands 64 uniform bytes via expand_message_xmd(SHA-512) and maps via from_uniform_bytes.

    Point::identity

    fn Point::identity() -> Point

    Returns the Ristretto255 group identity element (0, 1, 1, 0).

    Point::is_identity

    fn Point::is_identity(self : Point) -> Bool

    Returns true iff self represents the Ristretto255 identity element (constant-time).

    Point::mul

    fn Point::mul(self : Point, s : Scalar) -> Point

    Constant-time 4-bit fixed-window scalar multiplication s * self.

    Point::mul_base

    fn Point::mul_base(s : Scalar) -> Point

    Constant-time scalar multiplication of the standard generator s * B.

    Point::neg

    fn Point::neg(self : Point) -> Point

    Negates a point on the twisted Edwards curve: -(X, Y, Z, T) = (-X, Y, Z, -T).

    Point::sub

    fn Point::sub(self : Point, other : Point) -> Point

    Point subtraction self - other.

    Scalar

    pub struct Scalar {
    // private fields
    } derive(
    Debug
    )

    Canonical scalar in [0, l - 1], represented as 8 x 32-bit little-endian limbs.
    impl Eq for Scalar

    Scalar::add

    fn Scalar::add(self : Scalar, other : Scalar) -> Scalar

    Constant-time scalar addition modulo l.

    Scalar::compare

    fn Scalar::compare(self : Scalar, other : Scalar) -> Int

    Constant-time comparison of canonical scalars as integers in [0, l - 1]. Returns -1 if self < other, 0 if self == other, 1 if self > other.

    Scalar::from_bytes_canonical

    fn Scalar::from_bytes_canonical(bytes : Bytes) -> Scalar raise RistrettoError

    Strictly decodes a canonical 32-byte little-endian scalar (< l).

    Scalar::from_bytes_mod_order_wide

    fn Scalar::from_bytes_mod_order_wide(bytes : Bytes) -> Scalar raise RistrettoError

    Reduces a 64-byte little-endian unsigned integer modulo group order l (RFC 9497 §4.1). Splits into four 128-bit chunks (< l): w0 + w1*2^128 + w2*2^256 + w3*2^384 (mod l).

    Scalar::from_u32

    fn Scalar::from_u32(n : UInt) -> Scalar

    Constructs a canonical scalar from a 32-bit unsigned integer n (n < 2^32 < l).

    Scalar::hash_to_scalar

    fn Scalar::hash_to_scalar(msg : Bytes, dst : Bytes) -> Scalar raise RistrettoError

    RFC 9497 §4.1 HashToScalar(msg, DST) for ristretto255-SHA512: expands 64 uniform bytes via expand_message_xmd(SHA-512) and reduces little-endian mod l.

    Scalar::invert

    fn Scalar::invert(self : Scalar) -> Scalar raise RistrettoError

    Constant-time multiplicative inverse modulo l via Fermat's Little Theorem s^(l - 2) mod l. Raises ZeroScalar if self == 0.

    Scalar::is_zero

    fn Scalar::is_zero(self : Scalar) -> Bool

    Returns true iff self == 0 (constant-time).

    Scalar::mul

    fn Scalar::mul(self : Scalar, other : Scalar) -> Scalar

    Constant-time scalar multiplication modulo l.

    Scalar::neg

    fn Scalar::neg(self : Scalar) -> Scalar

    Constant-time scalar negation modulo l.

    Scalar::one

    fn Scalar::one() -> Scalar

    Returns the multiplicative identity scalar 1.

    Scalar::sub

    fn Scalar::sub(self : Scalar, other : Scalar) -> Scalar

    Constant-time scalar subtraction modulo l.

    Scalar::to_bytes

    fn Scalar::to_bytes(self : Scalar) -> Bytes

    Serializes this scalar as 32-byte little-endian canonical Bytes.

    Scalar::zero

    fn Scalar::zero() -> Scalar

    Returns the additive identity scalar 0.