def sp.prekeys

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

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

314def sp.prekeys(n: Nat, +i: U32, win: List<&2, U32>) -> List<&2, U32>:
315  match n:
316    case 0n:
317      Nil{}
318    case 1n+p:
319      match win:
320        case Con{a, Con{b, Con{c, Con{+d, Con{e, Con{+f, Con{g, Con{+h, t}}}}}}}}:
321          +w = L.lc.rotl(U32.xor(U32.xor(U32.xor(a, d), U32.xor(f, h)), U32.xor(2654435769, i)), 11n)
322          Con{w, sp.prekeys(p, U32.add(i, 1), [b, c, d, e, f, g, h, w])}
323        case _:
324          Nil{}

Uses (6)

Used by (1)