def suffix

bend-collections-laws-crypto@1.0.0.0 · src/crypto/sha/core.bend:663

import bend-collections-laws-crypto@1.0.0.0/src/crypto/sha/core.bend as Core
import Base

663# FIPS padding suffix for a message of n bytes, computed with modular
664# arithmetic. The proofs state the streaming hash in terms of it.
665def suffix(+n: Nat) -> List<&2, U32>:
666  128 <> List.append(&2, U32,
667    List.replicate(U32, Nat.mod(Nat.sub(119n, Nat.mod(n, 64n)), 64n), 0), bit_length(n))

Uses (8)

Used by (8)