def absorb

bend-collections-laws-crypto@1.0.0.0 · src/crypto/sha3/core.bend:47

import bend-collections-laws-crypto@1.0.0.0/src/crypto/sha3/core.bend as Core
import Base
import bend-collections-laws-crypto@1.0.0.0/src/crypto/keccak/types.bend as T
import bend-collections-laws-crypto@1.0.0.0/src/crypto/keccak/permutation.bend as P

47# Absorb every whole block of 17 lanes with the given round count (24).
48def absorb(ls: List<&2, T.Lane>, +rounds: Nat, s: T.State) -> T.State:
49  match ls:
50    case l0 <> l1 <> l2 <> l3 <> l4 <> l5 <> l6 <> l7 <> l8 <> l9 <> l10 <> l11 <> l12 <> l13 <> l14 <> l15 <> l16 <> rest:
51      absorb(rest, rounds, P.rounds(rounds, 0n, inject(s, l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16)))
52    case _:
53      s

Uses (6)

Used by (11)