def sm4.unstep

bend-osdev-legacy-ciphers@0.1.0.0 · sm4.bend:65

import bend-osdev-legacy-ciphers@0.1.0.0/sm4.bend as Sm4
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

65# the round undone
66def sm4.unstep(+tab: L.LcTab, rk: U32, s: M.CmBlock) -> M.CmBlock:
67  match s:
68    case M.CmBlock{+y0, +y1, +y2, y3}:
69      M.CmBlock{U32.xor(y3, sm4.t(tab, U32.xor(U32.xor(U32.xor(y0, y1), y2), rk))), y0, y1, y2}

Uses (5)

Used by (4)