def cbcp.ins

bend-osdev-cbc@0.1.0.0 · PROOF.bend:291

import bend-osdev-cbc@0.1.0.0/PROOF.bend as PROOF
import Base
import bend-osdev-mode-core@0.1.0.0/mode_core.bend as M

291# the blocks CBC encryption gives the cipher: each plaintext block XOR the
292# block before it (the IV first)
293def cbcp.ins(~K: Data, ~enc: K -> M.CmBlock -> M.CmBlock, +k: K, bs: List<&2, M.CmBlock>, +iv: M.CmBlock) -> List<&2, M.CmBlock>:
294  match bs:
295    case Nil{}:
296      Nil{}
297    case Con{+p, t}:
298      Con{M.CmBlock.xor(iv, p), cbcp.ins(~K, ~enc, k, t, enc(k, M.CmBlock.xor(iv, p)))}

Uses (3)

Used by (3)