def LcTwofish.key_padded

bend-osdev-legacy-ciphers@0.1.0.0 · twofish.bend:358

import bend-osdev-legacy-ciphers@0.1.0.0/twofish.bend as Twofish
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

358# a key of 1 to 32 bytes, zero-padded as the specification says
359def LcTwofish.key_padded(o: B.Octets) -> Result<&2, &2, L.LcError, LcTwofishKey>:
360  +xs = B.Octets.to_list(o)
361  +n = B.len(xs)
362  tf.pad.pick(Bool.and(Nat.is_lt(0n, n), Nat.is_le(n, 16n)), Nat.is_le(n, 24n), Nat.is_le(n, 32n), n, xs)

Uses (10)

Used by (0)

No other definition uses this definition.