LAWS.cbc_round_trip: law of bend-osdev-cipher-modes@0.1.0.0 Import: import bend-osdev-cipher-modes@0.1.0.0/LAWS.bend as LAWS Lines 30-42 of bend-osdev-cipher-modes@0.1.0.0/LAWS.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-cipher-modes@0.1.0.0/LAWS.bend&start_line=30&end_line=42 import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend as M import bend-osdev-cipher-modes@0.1.0.0/cbc.bend as C # CBC on bytes: for every 16-byte IV and every message of whole blocks, # encryption succeeds and decryption gives the message back law cbc_round_trip: for ~K: Data for ~enc: K -> M.CmBlock -> M.CmBlock for ~dec: K -> M.CmBlock -> M.CmBlock for ~inv: @k: K -> @b: M.CmBlock -> {dec(k, enc(k, b)) == b : M.CmBlock} for +k: K for +iv: B.Octets for +m: B.Octets for hi: {B.Octets.len(iv) == 16n : Nat} for hm: {Nat.mod(B.Octets.len(m), 16n) == 0n : Nat} {Result.bind(&2, &2, M.CmError, B.Octets, B.Octets, C.Cbc.encrypt(~K, ~enc, k, iv, m), c => C.Cbc.decrypt(~K, ~dec, k, iv, c)) == Done{m} : Result<&2, &2, M.CmError, B.Octets>} Uses (46): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.sym 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=Nat.mod 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=U32 https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/LAWS.bend&name=octets_of_to https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/LAWS.bend&name=octets_to_of 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.len 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=Octets.to_list 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=mask https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=cbcp.go https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=cbcp.iv https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=oc.masked https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=oc.mod https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=sp.eta https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=sp.join_split https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=sp.mask_join https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=sp.mod_tail https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=sp.split_join https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=tr.bind_cong https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=tr.cbc_decrypt https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/PROOF.bend&name=tr.cbc_encrypt https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=Cbc.decrypt https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=Cbc.decrypt.ref https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=Cbc.encrypt https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=Cbc.encrypt.ref https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=cbc.d1 https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=cbc.d2 https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=cbc.dec https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=cbc.e1 https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=cbc.e2 https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=cbc.enc https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cbc.bend&name=cbc.iv https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend&name=CmBlock https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend&name=CmError https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend&name=CmSplit https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend&name=cm.block_of https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend&name=cm.join_onto https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend&name=cm.split https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend&name=cm.split.blocks https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend&name=cm.split.tail