def gather

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/blake/blake2b.bend:237

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

237# Reads the block's 32 words base+0 .. base+31 from the array, then compresses.
238def gather(n: Nat, +base: U32, +next: U32, +last: Bool, +remain: Nat, t: T.Counter, h: T.Chain, acc: List<&2,U32>, pair: Array<U32> & U32) -> Array<U32> & T.Chain:
239  match n pair:
240    case 0n Tuple{a,w}:
241      (a,compress(h,lanes(prepare(last,List.reverse(&2,U32,w <> acc),remain)),t,last))
242    case 1n+p Tuple{a,w}:
243      gather(p,base,U32.inc(next),last,remain,t,h,w <> acc,Array.get(U32,a,U32.add(base,next)))

Uses (16)

Used by (66)