def tdes_cbc

bend-osdev-crypto@0.1.0.0 · check.bend:201

import bend-osdev-crypto@0.1.0.0/check.bend as Check
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 bend-osdev-legacy-ciphers@0.1.0.0/tdes.bend as T
import bend-osdev-crypto@0.1.0.0/crypto.bend as Cr
import bend-osdev-crypto@0.1.0.0/modes.bend as Md
import bend-osdev-crypto@0.1.0.0/inst_lc.bend as LC

201def tdes_cbc(+k: B.Octets, +iv: B.Octets, +m: B.Octets) -> String:
202  +r = LC.CrLc.key(~T.LcTdesKey, ~T.LcTdes.key, k)
203  +c = Result.bind(&2, &2, Cr.CrError, T.LcTdesKey, B.Octets, r, kk => Md.CrCbc.encrypt(~T.LcTdesKey, ~L.LcBlock64, ~8n, ~T.LcTdes.encrypt, ~LC.CrBlk64.xor, ~L.LcBlock64.of_octets, ~L.LcBlock64.to_octets, kk, iv, m))
204  both(c, Result.bind(&2, &2, Cr.CrError, T.LcTdesKey, B.Octets, r, kk => Result.bind(&2, &2, Cr.CrError, B.Octets, B.Octets, c, x => Md.CrCbc.decrypt(~T.LcTdesKey, ~L.LcBlock64, ~8n, ~T.LcTdes.decrypt, ~LC.CrBlk64.xor, ~L.LcBlock64.of_octets, ~L.LcBlock64.to_octets, kk, iv, x))))

Uses (16)

Used by (1)