Kbkdf.cr.kb.ctr: def of bend-osdev-crypto@0.1.0.0 Import: import bend-osdev-crypto@0.1.0.0/kbkdf.bend as Kbkdf Lines 47-59 of bend-osdev-crypto@0.1.0.0/kbkdf.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-crypto@0.1.0.0/kbkdf.bend&start_line=47&end_line=59 import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B # n more bytes in counter mode: the rest of the current block cur, then # PRF(K_IN, [i + 1]_2 || fixed), ... def cr.kb.ctr(~K: Data, ~compute: K -> B.Octets -> B.Octets, n: Nat, cur: List<&2, U32>, +k: K, +rlen: Nat, +fixed: B.Octets, +i: U32) -> List<&2, U32>: match n: case 0n: Nil{} case 1n+p: match cur: case Con{h, t}: Con{h, cr.kb.ctr(~K, ~compute, p, t, k, rlen, fixed, i)} case Nil{}: +blk = B.Octets.to_list(compute(k, B.Octets.append(CrKbkdf.counter(rlen, U32.add(i, 1)), fixed))) Con{cr.kb.head(blk), cr.kb.ctr(~K, ~compute, p, cr.kb.tail(blk), k, rlen, fixed, U32.add(i, 1))} Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List 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.add https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets.append https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets.to_list https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/kbkdf.bend&name=CrKbkdf.counter https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/kbkdf.bend&name=cr.kb.head https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/kbkdf.bend&name=cr.kb.tail