Vmac.cr.vm.pdf: def of bend-osdev-crypto@0.1.0.0 Import: import bend-osdev-crypto@0.1.0.0/vmac.bend as Vmac Lines 422-429 of bend-osdev-crypto@0.1.0.0/vmac.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-crypto@0.1.0.0/vmac.bend&start_line=422&end_line=429 import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import bend-osdev-word64@0.1.0.0/word64.bend as W # the PDF's words for a nonce of 1 to 15 bytes def cr.vm.pdf(~K: Data, ~Blk: Data, ~bsize: Nat, ~enc: K -> Blk -> Blk, ~blk_of: B.Octets -> Maybe<&2, Blk>, ~blk_to: Blk -> B.Octets, +k: K, +words: Nat, +nonce: List<&2, U32>) -> List<&2, W.W64>: +n = B.len(nonce) +last = cr.vm.at(nonce, Nat.sub(n, 1n)) +bit = U32.and(1, last) +cleared = B.append(B.take(Nat.sub(n, 1n), nonce), [cr.vm.pdf.last(Nat.is_eq(words, 1n), last)]) +t = cr.vm.e(~K, ~Blk, ~enc, ~blk_of, ~blk_to, k, B.Octets.of_list(B.append(B.zeros(Nat.sub(bsize, n)), cleared))) cr.vm.pdf.pick(Nat.is_eq(words, 1n), U32.is_eq(bit, 1), t, words) Uses (19): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq 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.of_list https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=append https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=len https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=take https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=zeros https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/vmac.bend&name=cr.vm.at https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/vmac.bend&name=cr.vm.e https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/vmac.bend&name=cr.vm.pdf.last https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/vmac.bend&name=cr.vm.pdf.pick https://jend.leeeet.dev/definition.txt?path=bend-osdev-word64@0.1.1.0/word64.bend&name=W64