def sp.unop

bend-osdev-legacy-ciphers@0.1.0.0 · serpent.bend:257

import bend-osdev-legacy-ciphers@0.1.0.0/serpent.bend as Serpent
import Base
import bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend as M
import bend-osdev-legacy-ciphers@0.1.0.0/legacy_ciphers.bend as L

257# the step undone
258def sp.unop(o: LcSpOp, s: M.CmBlock) -> M.CmBlock:
259  match o:
260    case LcSpBswap{}:
261      match s:
262        case M.CmBlock{a, b, c, d}:
263          M.CmBlock{L.lc.bswap.bits(a), L.lc.bswap.bits(b), L.lc.bswap.bits(c), L.lc.bswap.bits(d)}
264    case LcSpKey{k}:
265      M.CmBlock.xor(s, k)
266    case LcSpS{b}:
267      sp.sop(b, True{}, s)
268    case LcSpLt{}:
269      sp.ilt(s)

Uses (7)

Used by (6)