def gather
bend-collections@1.0.0.0 · spec/crypto/keccak/main.bend:47
import bend-collections@1.0.0.0/spec/crypto/keccak/main.bend as BendCollections
import Base
import bend-collections@1.0.0.0/src/crypto/keccak/types.bend as T
import bend-collections@1.0.0.0/spec/crypto/keccak/permutation.bend as F
47def gather(+round_count: Nat, n: Nat, +base: U32, +next: U32, +padding: Bool, +remain: Nat, s: T.State, acc: List<&2,U32>, pair: Array<U32> & U32) -> Array<U32> & T.State:
48 match n pair:
49 case 0n Tuple{a,w}:
50 (a,F.rounds(round_count,0n,inject(s,prepare(padding,List.reverse(&2,U32,w <> acc),remain))))
51 case 1n+p Tuple{a,w}:
52 gather(round_count,p,base,U32.inc(next),padding,remain,s,w <> acc,Array.get(U32,a,U32.add(base,next)))