def chunks

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/blake/blake3.bend:203

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/blake/blake3.bend as Blake3
import Base
import bend-collections-laws-crypto@1.0.0.0/src/crypto/blake/blake3/types.bend as T

203# The outputs of the chunks, in order; `pair` holds the current chunk, n
204# chunks follow it, the last one of len bytes.
205def chunks(+n: Nat, +t: U32, +index: U32, +len: Nat, pair: Array<U32> & T.Out) -> List<&2,T.Out>:
206  match n pair:
207    case 0n Tuple{a,o}: Con{o,Nil{}}
208    case 1n+p Tuple{a,o}: Con{o,chunks(p,U32.inc(t),U32.add(index,256),len,chunk_at(p,U32.inc(t),U32.add(index,256),len,a))}

Uses (10)

Used by (10)