def digest_bytes

bend-collections@1.0.0.0 · proofs/crypto/sha/packed/legacy_model.bend:38

import bend-collections@1.0.0.0/proofs/crypto/sha/packed/legacy_model.bend as LegacyModel
import Base

38# Big-endian octets, represented as U32 values in 0..255.
39def digest_bytes(ws: List<&2, U32>) -> List<&2, U32>:
40  match ws:
41    case Nil{}:
42      Nil{}
43    case +w <> tail:
44      U32.and(U32.shrn(w, 24n), 255) <>
45      U32.and(U32.shrn(w, 16n), 255) <>
46      U32.and(U32.shrn(w, 8n), 255) <>
47      U32.and(w, 255) <> digest_bytes(tail)

Uses (4)

Used by (2)