def toy.rot
import bend-osdev-cbc@0.1.0.0/check.bend as Checkimport Base
import bend-osdev-mode-core@0.1.0.0/mode_core.bend as M
65# A toy permutation of blocks, NOT a cipher: the words rotated, then XOR
66# with the key block. Enough to run the mode's code paths (encryption and
67# decryption differ, so mixing them up shows); the mode is tested against
68# its specification over AES in bend-osdev-aes-modes (the specifications'
69# vectors) and in ref/ (against Python's cryptography).
70def toy.rot(b: M.CmBlock) -> M.CmBlock:
71 match b:
72 case M.CmBlock{w0, w1, w2, w3}:
73 M.CmBlock{w1, w2, w3, w0}