PROOF.bend source
PROOF.bend on the hub · documented module
import Baseimport bend-osdev-bytes@0.1.1.0/bytes.bend as Bimport bend-osdev-cipher-core@0.1.0.0/cipher_core.bend as Limport bend-osdev-cipher-core@0.1.0.0/LAWS.bend as CoreLimport bend-osdev-cipher-core@0.1.0.0/PROOF.bend as CorePimport ./cast5.bend as C5import ./LAWS.bend as Lawsdef swap2(b: L.LcBlock64) -> {b == L.lc.swap(L.lc.swap(b)) : L.LcBlock64}: match b: case L.LcBlock64{h, l}: {==}# CAST-128: its rounds, then the exchange of the halves, undonedef Laws.cast5_round_trip(k, b): match k: case C5.LcCast5Key{+rks}: %swap2(L.lc.fe.run(~C5.LcCast5Rk, ~C5.cast5.f, rks, b)) : {L.lc.fe.unrun(~C5.LcCast5Rk, ~C5.cast5.f, rks, _) == b : L.LcBlock64} Equal.sym(L.LcBlock64, b, L.lc.fe.unrun(~C5.LcCast5Rk, ~C5.cast5.f, rks, L.lc.fe.run(~C5.LcCast5Rk, ~C5.cast5.f, rks, b)), CoreL.feistel_unrun_run(~C5.LcCast5Rk, ~C5.cast5.f, rks, b))def Laws.cast5_round_trip_dual(k, b): match k: case C5.LcCast5Key{+rks}: %CoreL.feistel_run_unrun(~C5.LcCast5Rk, ~C5.cast5.f, rks, L.lc.swap(b)) : {L.lc.swap(_) == b : L.LcBlock64} Equal.sym(L.LcBlock64, b, L.lc.swap(L.lc.swap(b)), swap2(b))# BEGIN GENERATED by gen/vectors.py: vectorsdef Laws.cast5_rfc2144(): {==}def Laws.cast5_bad_key_length(): {==}# END GENERATED: vectors