def digest_bytes

bend-collections-laws-crypto@1.0.0.0 · src/crypto/sha/sha256.bend:33

import bend-collections-laws-crypto@1.0.0.0/src/crypto/sha/sha256.bend as Sha256
import Base

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

Uses (4)

Used by (7)