def bits_bytes

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/aes/gcm.bend:26

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/aes/gcm.bend as Gcm
import Base

26# The byte whose bits, leftmost first, are the next eight of a bit string.
27def bits_bytes(bs: List<&2, Bool>) -> List<&2, U32>:
28  match bs:
29    case b7 <> b6 <> b5 <> b4 <> b3 <> b2 <> b1 <> b0 <> rest:
30      U32{WCon{b0, WCon{b1, WCon{b2, WCon{b3, WCon{b4, WCon{b5, WCon{b6, WCon{b7, Word.zero(24n)}}}}}}}}} <> bits_bytes(rest)
31    case _:
32      Nil{}

Uses (5)

Used by (2)