def bf.cycle

bend-osdev-legacy-ciphers@0.1.0.0 · blowfish.bend:235

import bend-osdev-legacy-ciphers@0.1.0.0/blowfish.bend as Blowfish
import Base

235# the key bytes repeated cyclically: n bytes, from the rest of the key ys
236# (the whole key xs when ys runs out)
237def bf.cycle(n: Nat, ys: List<&2, U32>, +xs: List<&2, U32>) -> List<&2, U32>:
238  match n:
239    case 0n:
240      Nil{}
241    case 1n+p:
242      match ys:
243        case Con{y, t}:
244          Con{y, bf.cycle(p, t, xs)}
245        case Nil{}:
246          match xs:
247            case Nil{}:
248              Nil{}
249            case Con{x, t}:
250              Con{x, bf.cycle(p, t, xs)}

Uses (3)

Used by (1)