check.bend checks
raw source on the hub · import bend-osdev-cbc@0.1.0.0/check.bend as Check
CBC over a toy permutation (below): the block and byte layers both ways, padding, and the refusals; and 32 KB through CBC and back. The specification's vectors (SP 800-38A F.2) run over AES in bend-osdev-aes-modes' check.bend.
4 imports
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 ./cbc.bend as C
Definitions
def err source · line 10 · raw
@e:0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmError -> String
def res source · line 35 · raw
@r:Result<&2, &2, 0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmError, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets> -> String
def back source · line 43 · raw
@r:Result<&2, &2, 0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmError, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets> -> @+m:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> String
whether r is m
def bytes.go source · line 51 · raw
@n:Nat -> @+s:U32 -> @acc:List<&2, U32> -> List<&2, U32>
n pseudo-random bytes (a linear congruential generator)
def msg source · line 59 · raw
@n:Nat -> 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets
def iv source · line 62 · raw
0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets
def toy.rot source · line 70 · raw
@b:0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock -> 0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock
A toy permutation of blocks, NOT a cipher: the words rotated, then XOR with the key block. Enough to run the mode's code paths (encryption and decryption differ, so mixing them up shows); the mode is tested against its specification over AES in bend-osdev-aes-modes (the specifications' vectors) and in ref/ (against Python's cryptography).
def toy.unrot source · line 75 · raw
@b:0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock -> 0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock
def toy.enc source · line 80 · raw
@k:0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock -> @b:0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock -> 0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock
def toy.dec source · line 83 · raw
@k:0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock -> @c:0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock -> 0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock
def key source · line 86 · raw
0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock
def key2 source · line 89 · raw
0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock
def hexs source · line 92 · raw
@bs:List<&2, 0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock> -> String
def main source · line 99 · raw
IO(Unit)