lattice_squeeze
stdlib/lattice/lattice_squeeze.nbv
lattice_squeeze(pending, static a_absorb)
One squeeze of a fresh lattice sponge over pending (dags LatticeSponge::squeeze_safe): the padded digest is placed after the lattice_output_len output lanes of the Poseidon state, followed by the number of absorbed elements as a tag and zeros, the permutation is applied and the output lanes are returned.
- Calls
calloc,lattice/lattice_digest,dilithium/lattice/lattice_kappa,dilithium/lattice/lattice_output_len,dilithium/lattice/lattice_permutation,dilithium/lattice/lattice_t,slice_from_start- Precompiles
assert_lt!,assert_lte!,concat!,len!- Used by
lattice/lattice_oraccle_sample,lattice/lattice_oraccle_sample_vec,lattice/lattice_oraccle_squeeze
Source
# One squeeze of a fresh lattice sponge over `pending` (dags LatticeSponge::squeeze_safe):
# the padded digest is placed after the `lattice_output_len` output lanes of the Poseidon
# state, followed by the number of absorbed elements as a tag and zeros, the permutation is
# applied and the output lanes are returned.
(pending, static a_absorb)
static kappa = lattice_kappa()
static out_len = lattice_output_len()
static t = lattice_t()
static n = len! pending
assert_lt! 0, n, "refusing to squeeze an empty sponge"
assert_lte! out_len + kappa + 1, t
let state = lattice_digest(pending, a_absorb)
let perm = lattice_permutation(concat! calloc(out_len), state, [n], calloc(t - out_len - kappa - 1))
slice_from_start(perm, out_len)