def tea.key.pick
bend-osdev-legacy-ciphers@0.1.0.0 · tea.bend:144
import bend-osdev-legacy-ciphers@0.1.0.0/tea.bend as Tea
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
144def tea.key.pick(ok: Bool, +le: Bool, n: Nat, +xs: List<&2, U32>) -> Result<&2, &2, L.LcError, LcTeaKey>:
145 match ok:
146 case True{}:
147 Done{LcTeaKey{tea.order(le, tea.cycles(n, 0, tea.word(le, xs, 0n), tea.word(le, xs, 4n), tea.word(le, xs, 8n), tea.word(le, xs, 12n)))}}
148 case False{}:
149 Fail{L.LcBadKeyLength{B.len(xs)}}