def LcBlowfish.key_any

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

import bend-osdev-legacy-ciphers@0.1.0.0/blowfish.bend as Blowfish
import Base
import bend-osdev-bytes@0.1.0.0/bytes.bend as B
import bend-osdev-legacy-ciphers@0.1.0.0/legacy_ciphers.bend as L

369# a key of 1 to 72 bytes: the key schedule takes up to 72 (18 words of P),
370# and some test sets use keys shorter than 4 bytes
371def LcBlowfish.key_any(o: B.Octets) -> Result<&2, &2, L.LcError, LcBlowfishKey>:
372  +xs = B.Octets.to_list(o)
373  +n = B.len(xs)
374  bf.key.pick(Bool.and(Nat.is_le(1n, n), Nat.is_le(n, 72n)), xs)

Uses (9)

Used by (1)