def cam.key.pick
bend-osdev-legacy-ciphers@0.1.0.0 · camellia.bend:317
import bend-osdev-legacy-ciphers@0.1.0.0/camellia.bend as Camellia
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
317
318def cam.key.pick(n16: Bool, n24: Bool, n32: Bool, +xs: List<&2, U32>) -> Result<&2, &2, L.LcError, LcCamelliaKey>:
319 match n16 n24 n32:
320 case True{} _ _:
321 Done{cam.key128(xs)}
322 case False{} True{} _:
323 Done{cam.key192(xs)}
324 case False{} False{} True{}:
325 Done{cam.key256(xs)}
326 case False{} False{} False{}:
327 Fail{L.LcBadKeyLength{B.len(xs)}}