def des.sp.go

bend-osdev-legacy-ciphers@0.1.0.0 · des.bend:183

import bend-osdev-legacy-ciphers@0.1.0.0/des.bend as Des
import Base

183# the SP table of S-box s, its output placed sh bits up (28 for S1 .. 0 for
184# S8): entry x is P of S(x) in place
185def des.sp.go(n: Nat, +s: List<&2, U32>, +sh: Nat, +x: U32) -> List<&2, U32>:
186  match n:
187    case 0n:
188      Nil{}
189    case 1n+p:
190      Con{des.perm32(des.p.table(), U32.shln(des.sbox(s, x), sh), 0), des.sp.go(p, s, sh, U32.add(x, 1))}

Uses (8)

Used by (1)