inst_lc.bend checks
raw source on the hub · import bend-osdev-crypto@0.1.0.0/inst_lc.bend as Inst_lc
The adapter for legacy-ciphers: its error type mapped onto CrError, its key schedules as the block-cipher interface's ~key, and the XOR of its 64-bit block LcBlock64 (an open type). The 64-bit block format is legacy-ciphers' own LcBlock64.of_octets and LcBlock64.to_octets, whose law it proves (block64_octets_round_trip); the 128-bit ciphers use inst_cm.bend's format.
Each cipher is then an instance with no code of its own, for example SM4: ~S.LcSm4Key, ~M.CmBlock, ~16n, ~CrLc.key(~S.LcSm4Key, ~S.LcSm4.key), ~S.LcSm4.encrypt, ~S.LcSm4.decrypt, ~CrBlk128.of_octets, ~CrBlk128.to_octets, ~CrBlk128.xor (README.md lists every instance).
4 imports
import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import bend-osdev-legacy-ciphers@0.1.0.0/legacy_ciphers.bend as L import ./crypto.bend as Cr
Definitions
def CrLc.err source · line 18 · raw
@e:0x7d16ec09f99b830428c8e2852af315f6/legacy_ciphers.LcError -> 0x01313a4f070f7ffd2bd276fcd2143eda/crypto.CrError
def CrBlk64.xor source · line 36 · raw
@a:0x7d16ec09f99b830428c8e2852af315f6/legacy_ciphers.LcBlock64 -> @b:0x7d16ec09f99b830428c8e2852af315f6/legacy_ciphers.LcBlock64 -> 0x7d16ec09f99b830428c8e2852af315f6/legacy_ciphers.LcBlock64
The 64-bit block's XOR
Templates
template CrLc.lift source · line 28 · raw
@-A:Data -> @r:Result<&2, &2, 0x7d16ec09f99b830428c8e2852af315f6/legacy_ciphers.LcError, A> -> Result<&2, &2, 0x01313a4f070f7ffd2bd276fcd2143eda/crypto.CrError, A>
a legacy-ciphers result as an interface result
template CrLc.key source · line 32 · raw
@-K:Data -> @-key:(@_:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> Result<&2, &2, 0x7d16ec09f99b830428c8e2852af315f6/legacy_ciphers.LcError, K>) -> @o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> Result<&2, &2, 0x01313a4f070f7ffd2bd276fcd2143eda/crypto.CrError, K>
a legacy-ciphers key schedule as the interface's ~key