Kdf.blocks: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/src/crypto/kdf.bend as Kdf Lines 26-37 of bend-collections@1.0.0.0/src/crypto/kdf.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/src/crypto/kdf.bend&start_line=26&end_line=37 import Base import bend-collections@1.0.0.0/src/crypto/mac.bend as MAC # The blocks T(i), T(i+1), ... cut to rem bytes: prev is T(i-1) and ctr the # counter byte i. Generation stops as soon as rem bytes are out, and no # block count is computed. def blocks(rem: Nat, +prk: List<&2, U32>, +info: List<&2, U32>, prev: List<&2, U32>, +ctr: U32) -> List<&2, U32>: match rem: case 0n: Nil{} case 32n+r: +t = MAC.sign(prk, List.append(&2, U32, prev, List.append(&2, U32, info, [ctr]))) List.append(&2, U32, t, blocks(r, prk, info, t, U32.inc(ctr))) case 1n+p: List.take(&2, U32, MAC.sign(prk, List.append(&2, U32, prev, List.append(&2, U32, info, [ctr]))), 1n+p) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.take https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.inc https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/mac.bend&name=sign