Mac.mask: def of bend-collections-laws-crypto@1.0.0.0 Import: import bend-collections-laws-crypto@1.0.0.0/src/crypto/mac.bend as Mac Lines 42-53 of bend-collections-laws-crypto@1.0.0.0/src/crypto/mac.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/mac.bend&start_line=42&end_line=53 import Base # The n-byte block (key zero-padded to n bytes) XOR the pad byte, in one # pass: past the end of the key a byte is 0 XOR pad = pad. def mask(key: List<&2, U32>, n: Nat, +pad: U32) -> List<&2, U32>: match key n: case Nil{} 0n: Nil{} case Nil{} 1n+p: pad <> mask(Nil{}, p, pad) case k <> rest 0n: Nil{} case k <> rest 1n+p: U32.xor(k, pad) <> mask(rest, p, pad) Uses (4): 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.xor