Skip to main content

Module scalar

Module scalar 

Source
Expand description

P-256 scalar field helpers.

Wraps p256::Scalar operations needed for Shamir secret sharing and Lagrange interpolation.

Functionsยง

random_scalar
Generate a random scalar.
scalar_add
Add two scalars.
scalar_from_bytes
Convert raw big-endian bytes (32 bytes) into a Scalar. Returns None if bytes are not 32 long or if the value is out of range.
scalar_invert
Modular inverse of a scalar (1/a mod n). Returns ZERO if a is zero.
scalar_mul
Multiply two scalars.
scalar_sub
Subtract one scalar from another.
scalar_to_bytes
Convert a Scalar to 32 big-endian bytes.