Hkdf.t_blocks: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/spec/crypto/hkdf.bend as Hkdf Lines 21-31 of bend-collections@1.0.0.0/spec/crypto/hkdf.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/spec/crypto/hkdf.bend&start_line=21&end_line=31 import Base import bend-collections@1.0.0.0/spec/crypto/hmac.bend as HMAC # 2.3 Step 2: Expand. T(0) = empty string; for i = 1..N, # T(i) = HMAC-Hash(PRK, T(i-1) | info | the octet i). # t_blocks(n, prk, info, T(i), i) is T(i+1) | ... | T(i+n). def t_blocks(n: Nat, +prk: List<&2, U32>, +info: List<&2, U32>, prev: List<&2, U32>, +i: Nat) -> List<&2, U32>: match n: case 0n: Nil{} case 1n+p: +t = HMAC.hmac(prk, List.append(&2, U32, prev, List.append(&2, U32, info, [U32.from_nat(1n+i)]))) List.append(&2, U32, t, t_blocks(p, prk, info, t, 1n+i)) Uses (6): 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=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.from_nat https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/spec/crypto/hmac.bend&name=hmac