~/bend-docscommunity

LAWS.bend open laws/TODOs

raw source on the hub · import 0xda0a79228db9e23e2b16a2d1327feab5/LAWS.bend as LAWS

Laws about CAST-256 (cast6.bend): for every key (every key size) and block, decryption undoes encryption and encryption undoes decryption; and a refused key, proved by computation.

5 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 bend-osdev-cipher-core@0.1.0.0/cipher_core.bend as L
import ./cast6.bend as C6

Laws

law cast6_round_trip provedin PROOF.bendsource · line 12 · raw

@k:0xda0a79228db9e23e2b16a2d1327feab5/cast6.LcCast6Key -> @+b:0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock -> {0xda0a79228db9e23e2b16a2d1327feab5/cast6.LcCast6.decrypt(k, 0xda0a79228db9e23e2b16a2d1327feab5/cast6.LcCast6.encrypt(k, b)) == b : 0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock}

law cast6_round_trip_dual provedin PROOF.bendsource · line 17 · raw

@k:0xda0a79228db9e23e2b16a2d1327feab5/cast6.LcCast6Key -> @+b:0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock -> {0xda0a79228db9e23e2b16a2d1327feab5/cast6.LcCast6.encrypt(k, 0xda0a79228db9e23e2b16a2d1327feab5/cast6.LcCast6.decrypt(k, b)) == b : 0x999adc34209a88c2495b3a5407a5ad25/mode_core.CmBlock}

law cast6_bad_key_length provedin PROOF.bendsource · line 27 · raw

{Result.map(&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, 0xda0a79228db9e23e2b16a2d1327feab5/cast6.LcCast6Key, Unit, k => Unit{}, 0xda0a79228db9e23e2b16a2d1327feab5/cast6.LcCast6.key(0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets.of_list([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))) == Fail{0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBadKeyLength{18n}} : Result<&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, Unit>}

BEGIN GENERATED by gen/vectors.py: vectors a CAST-256 key of 18 bytes is refused