Skip to main content

sk_encode

Function sk_encode 

Source
pub fn sk_encode<P: Params>(
    rho: &[u8; 32],
    k_seed: &[u8; 32],
    tr: &[u8; 64],
    s1: &[[i32; 256]],
    s2: &[[i32; 256]],
    t0: &[[i32; 256]],
) -> Vec<u8> 
Expand description

Encode a secret key as bytes.

Implements Algorithm 24 of FIPS 204 (skEncode). The secret key is the concatenation of rho (32 bytes), K (32 bytes), tr (64 bytes), the l polynomials of s1 and k polynomials of s2 (each packed with bitlen(2*eta) bits per coefficient), and the k polynomials of t0 (each packed with 13 bits per coefficient).

  • rho: 32-byte public seed.
  • k_seed: 32-byte secret seed K.
  • tr: 64-byte hash of the public key.
  • s1: secret vector of l polynomials with coefficients in [-eta, eta].
  • s2: secret vector of k polynomials with coefficients in [-eta, eta].
  • t0: low-order bits vector (k polynomials from Power2Round).

Returns a byte vector of length P::SK_LEN.