def c6.sc
import bend-osdev-legacy-ciphers@0.1.0.0/cast6.bend as Cast6import Base
import bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend as M
import bend-osdev-legacy-ciphers@0.1.0.0/cast5.bend as C5
32# the four steps of Q, each undone by itself
33def c6.sc(k: LcCast6Ks, s: M.CmBlock) -> M.CmBlock:
34 match k:
35 case LcCast6Ks{m0, m1, m2, m3, r0, r1, r2, r3, t}:
36 match s:
37 case M.CmBlock{a, b, c, +d}:
38 M.CmBlock{a, b, U32.xor(c, C5.cast.f(C5.LcCastF1{}, t, d, m0, r0)), d}