def LcBlowfish.key
import bend-osdev-legacy-ciphers@0.1.0.0/blowfish.bend as Blowfishimport 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
363# a key of 4 to 56 bytes (32 to 448 bits, as the specification says)
364def LcBlowfish.key(o: B.Octets) -> Result<&2, &2, L.LcError, LcBlowfishKey>:
365 +xs = B.Octets.to_list(o)
366 +n = B.len(xs)
367 bf.key.pick(Bool.and(Nat.is_le(4n, n), Nat.is_le(n, 56n)), xs)