def LcTwofish.key
import bend-osdev-legacy-ciphers@0.1.0.0/twofish.bend as Twofishimport 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
339# a 16-, 24- or 32-byte key (Twofish-128, -192, -256, by its length)
340def LcTwofish.key(o: B.Octets) -> Result<&2, &2, L.LcError, LcTwofishKey>:
341 +xs = B.Octets.to_list(o)
342 +n = B.len(xs)
343 tf.key.pick(Nat.is_eq(n, 16n), Nat.is_eq(n, 24n), Nat.is_eq(n, 32n), xs)