Check.main: def of bend-osdev-cbc@0.1.0.0 Import: import bend-osdev-cbc@0.1.0.0/check.bend as Check Lines 99-117 of bend-osdev-cbc@0.1.0.0/check.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-cbc@0.1.0.0/check.bend&start_line=99&end_line=117 import Base import bend-osdev-bytes@0.1.1.0/bytes.bend as B import bend-osdev-mode-core@0.1.0.0/mode_core.bend as M import bend-osdev-cbc@0.1.0.0/cbc.bend as C def main() -> IO(Unit): +b1 : M.CmBlock = M.CmBlock{1122867, 1146447479, 2291772091, 3437096703} +b2 : M.CmBlock = M.CmBlock{1, 2, 3, 4} +m48 = msg(48n) +m21 = msg(21n) +big = msg(32768n) do IO: IO.print("cbc_blocks " ++ hexs(C.Cbc.encrypt_blocks(~M.CmBlock, ~toy.enc, key(), key2(), [b1, b2]))) IO.print("cbc_blocks_back " ++ hexs(C.Cbc.decrypt_blocks(~M.CmBlock, ~toy.dec, key(), key2(), C.Cbc.encrypt_blocks(~M.CmBlock, ~toy.enc, key(), key2(), [b1, b2])))) IO.print("cbc_enc " ++ res(C.Cbc.encrypt(~M.CmBlock, ~toy.enc, key(), iv(), m48))) IO.print("cbc_back " ++ back(Result.bind(&2, &2, M.CmError, B.Octets, B.Octets, C.Cbc.encrypt(~M.CmBlock, ~toy.enc, key(), iv(), m48), c => C.Cbc.decrypt(~M.CmBlock, ~toy.dec, key(), iv(), c)), m48)) IO.print("cbc_padded_enc " ++ res(C.Cbc.encrypt_padded(~M.CmBlock, ~toy.enc, key(), iv(), m21))) IO.print("cbc_padded_back " ++ back(Result.bind(&2, &2, M.CmError, B.Octets, B.Octets, C.Cbc.encrypt_padded(~M.CmBlock, ~toy.enc, key(), iv(), m21), c => C.Cbc.decrypt_padded(~M.CmBlock, ~toy.dec, key(), iv(), c)), m21)) IO.print("cbc_padded_empty_back " ++ back(Result.bind(&2, &2, M.CmError, B.Octets, B.Octets, C.Cbc.encrypt_padded(~M.CmBlock, ~toy.enc, key(), iv(), B.Octets.empty()), c => C.Cbc.decrypt_padded(~M.CmBlock, ~toy.dec, key(), iv(), c)), B.Octets.empty())) IO.print("cbc_not_whole_blocks " ++ res(C.Cbc.encrypt(~M.CmBlock, ~toy.enc, key(), iv(), msg(17n)))) IO.print("cbc_short_iv " ++ res(C.Cbc.encrypt(~M.CmBlock, ~toy.enc, key(), B.Octets.take(15n, iv()), m48))) IO.print("cbc_padded_empty_ciphertext " ++ res(C.Cbc.decrypt_padded(~M.CmBlock, ~toy.dec, key(), iv(), B.Octets.empty()))) IO.print("cbc_bad_padding " ++ res(Result.bind(&2, &2, M.CmError, B.Octets, B.Octets, C.Cbc.encrypt(~M.CmBlock, ~toy.enc, key(), iv(), B.Octets.zeros(16n)), c => C.Cbc.decrypt_padded(~M.CmBlock, ~toy.dec, key(), iv(), c)))) IO.print("cbc_32k " ++ back(Result.bind(&2, &2, M.CmError, B.Octets, B.Octets, C.Cbc.encrypt(~M.CmBlock, ~toy.enc, key(), iv(), big), c => C.Cbc.decrypt(~M.CmBlock, ~toy.dec, key(), iv(), c)), big)) Uses (28): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.print https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit 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.empty https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets.take https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets.zeros https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/cbc.bend&name=Cbc.decrypt https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/cbc.bend&name=Cbc.decrypt_blocks https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/cbc.bend&name=Cbc.decrypt_padded https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/cbc.bend&name=Cbc.encrypt https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/cbc.bend&name=Cbc.encrypt_blocks https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/cbc.bend&name=Cbc.encrypt_padded https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/check.bend&name=back https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/check.bend&name=hexs https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/check.bend&name=iv https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/check.bend&name=key https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/check.bend&name=key2 https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/check.bend&name=msg https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/check.bend&name=res https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/check.bend&name=toy.dec https://jend.leeeet.dev/definition.txt?path=bend-osdev-cbc@0.1.0.0/check.bend&name=toy.enc https://jend.leeeet.dev/definition.txt?path=bend-osdev-mode-core@0.1.0.0/mode_core.bend&name=CmBlock https://jend.leeeet.dev/definition.txt?path=bend-osdev-mode-core@0.1.0.0/mode_core.bend&name=CmError