A scalar in unpacked representation.

Fields

fe: Fe,

Functions

fn add(x: Scalar, y: Scalar) Scalar

Compute x+y (mod L)

fn dbl(n: Scalar) Scalar

Compute 2n (mod L)

fn equivalent(a: Scalar, b: Scalar) bool

Return true if a and b are equivalent.

fn fromBytes(s: CompressedScalar, endian: std.builtin.Endian) NonCanonicalError!Scalar

Unpack a serialized representation of a scalar.

fn fromBytes48(s: [48]u8, endian: std.builtin.Endian) Scalar

Reduce a 384 bit input to the field size.

fn fromBytes64(s: [64]u8, endian: std.builtin.Endian) Scalar

Reduce a 512 bit input to the field size.

fn invert(n: Scalar) Scalar

Compute x^-1 (mod L)

fn isOdd(n: Scalar) bool

Return true if the scalar is odd.

fn isSquare(n: Scalar) Scalar

Return true if n is a quadratic residue mod L.

fn isZero(n: Scalar) bool

Return true if the scalar is zero..

fn mul(x: Scalar, y: Scalar) Scalar

Compute x*y (mod L)

fn neg(n: Scalar) Scalar

Compute -x (mod L)

fn pow(a: Scalar, comptime T: type, comptime n: T) Scalar

Compute x^n (mod L)

fn random() Scalar

Return a random scalar < L.

fn sq(n: Scalar) Scalar

Compute x^2 (mod L)

fn sqrt(n: Scalar) NotSquareError!Scalar

Return the square root of L, or NotSquare if there isn’t any solutions.

fn sub(x: Scalar, y: Scalar) Scalar

Compute x-y (mod L)

fn toBytes(n: Scalar, endian: std.builtin.Endian) CompressedScalar

Pack a scalar into bytes.

Values