def tf.key.pick

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

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

326def tf.key.pick(n16: Bool, n24: Bool, n32: Bool, +xs: List<&2, U32>) -> Result<&2, &2, L.LcError, LcTwofishKey>:
327  match n16 n24 n32:
328    case True{} _ _:
329      Done{tf.key(2n, xs)}
330    case False{} True{} _:
331      Done{tf.key(3n, xs)}
332    case False{} False{} True{}:
333      Done{tf.key(4n, xs)}
334    case False{} False{} False{}:
335      Fail{L.LcBadKeyLength{B.len(xs)}}

Uses (8)

Used by (1)