Expand description
Encoding and decoding of keys, signatures, and polynomials. Encoding and decoding algorithms for ML-DSA (FIPS 204, Algorithms 9-28).
Provides bit-level packing and unpacking of polynomials and polynomial vectors into compact byte representations, as well as the Power2Round decomposition used during key generation.
All vector functions accept slices (&[[i32; N]]) instead of &Vec<...>
to avoid requiring heap-allocated containers.
Functionsยง
- bit_
pack - Pack a polynomial whose coefficients lie in [-a, b].
- bit_
unpack - Unpack a polynomial whose coefficients lie in [-a, b].
- hint_
bit_ pack - Pack a hint vector into bytes.
- hint_
bit_ unpack - Unpack a hint vector from bytes.
- pk_
decode - Decode a public key from bytes.
- pk_
encode - Encode a public key as bytes.
- power2round
- Decompose a coefficient into high and low parts using a power-of-2 divisor.
- power2round_
vec - Apply
power2roundto every coefficient of a polynomial vector. - sig_
decode - Decode a signature from bytes.
- sig_
encode - Encode a signature as bytes.
- simple_
bit_ pack - Pack a polynomial whose coefficients lie in [0, b].
- simple_
bit_ unpack - Unpack a polynomial whose coefficients lie in [0, b].
- sk_
decode - Decode a secret key from bytes.
- sk_
decode_ s1 - Decode a single polynomial of s1 from the packed secret key.
- sk_
decode_ s2 - Decode a single polynomial of s2 from the packed secret key.
- sk_
decode_ seeds - Decode only the seeds (rho, K, tr) from a secret key, without unpacking any polynomial. Returns 128 bytes of stack.
- sk_
decode_ t0 - Decode a single polynomial of t0 from the packed secret key.
- sk_
encode - Encode a secret key as bytes.
- w1_
encode - Encode the high-order bits vector w1 as bytes.