def sp.round_keys
bend-osdev-legacy-ciphers@0.1.0.0 · serpent.bend:326
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
326
327
328def sp.round_keys(n: Nat, +i: Nat, ws: List<&2, U32>) -> List<&2, M.CmBlock>:
329 match n:
330 case 0n:
331 Nil{}
332 case 1n+p:
333 match ws:
334 case Con{a, Con{b, Con{c, Con{d, t}}}}:
335 Con{sp.sop(sp.box(Nat.sub(35n, i)), False{}, M.CmBlock{a, b, c, d}), sp.round_keys(p, Nat.add(i, 1n), t)}
336 case _:
337 Nil{}