Lrw.CrLrw.encrypt: def of bend-osdev-crypto@0.1.0.0 Import: import bend-osdev-crypto@0.1.0.0/lrw.bend as Lrw Lines 135-143 of bend-osdev-crypto@0.1.0.0/lrw.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-crypto@0.1.0.0/lrw.bend&start_line=135&end_line=143 import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import bend-osdev-gf@0.1.0.0/gf128.bend as G import bend-osdev-crypto@0.1.0.0/crypto.bend as Cr import bend-osdev-crypto@0.1.0.0/modes.bend as Md # LRW on bytes: a message of whole blocks; the IV is the first block's # 16-byte big-endian index (CrBadIvLength, CrNotBlockMultiple otherwise) def CrLrw.encrypt(~K: Data, ~Blk: Data, ~bsize: Nat, ~enc: K -> Blk -> Blk, ~bxor: Blk -> Blk -> Blk, ~blk_of: B.Octets -> Maybe<&2, Blk>, ~blk_to: Blk -> B.Octets, kk: CrLrwKey, +iv: B.Octets, m: B.Octets) -> Result<&2, &2, Cr.CrError, B.Octets>: match kk: case CrLrwKey{+k, +k2}: do Result<&2, &2, Cr.CrError, B.Octets>: i : G.Gf128 <- cr.lrw.index(iv) bs : List<&2, Blk> <- Md.CrModes.blocks_of(~Blk, ~bsize, ~blk_of, m) return Md.CrModes.octets_of(~Blk, ~blk_to, CrLrw.encrypt_blocks(~K, ~Blk, ~enc, ~bxor, ~blk_of, k, k2, i, bs)) Uses (14): 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=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result.pure 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-crypto@0.1.0.0/crypto.bend&name=CrError https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/lrw.bend&name=CrLrw.encrypt_blocks https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/lrw.bend&name=CrLrwKey https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/lrw.bend&name=cr.lrw.index https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/modes.bend&name=CrModes.blocks_of https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/modes.bend&name=CrModes.octets_of https://jend.leeeet.dev/definition.txt?path=bend-osdev-gf@0.1.1.0/gf128.bend&name=Gf128