Twofish.tf.pad.pick: def of bend-osdev-legacy-ciphers@0.1.0.0 Import: import bend-osdev-legacy-ciphers@0.1.0.0/twofish.bend as Twofish Lines 345-356 of bend-osdev-legacy-ciphers@0.1.0.0/twofish.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-legacy-ciphers@0.1.0.0/twofish.bend&start_line=345&end_line=356 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 # the key padded with zero bytes to 16, 24 or 32 bytes (section 4.3: keys # shorter than 256 bits are padded with zeros to the next defined length) def tf.pad.pick(n16: Bool, n24: Bool, n32: Bool, +n: Nat, +xs: List<&2, U32>) -> Result<&2, &2, L.LcError, LcTwofishKey>: match n16 n24 n32: case True{} _ _: Done{tf.key(2n, B.append(xs, B.zeros(Nat.sub(16n, n))))} case False{} True{} _: Done{tf.key(3n, B.append(xs, B.zeros(Nat.sub(24n, n))))} case False{} False{} True{}: Done{tf.key(4n, B.append(xs, B.zeros(Nat.sub(32n, n))))} case False{} False{} False{}: Fail{L.LcBadKeyLength{n}} Uses (11): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.1/bytes.bend&name=append https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.1/bytes.bend&name=zeros https://jend.leeeet.dev/definition.txt?path=bend-osdev-legacy-ciphers@0.1.0.0/legacy_ciphers.bend&name=LcError https://jend.leeeet.dev/definition.txt?path=bend-osdev-legacy-ciphers@0.1.0.0/twofish.bend&name=LcTwofishKey https://jend.leeeet.dev/definition.txt?path=bend-osdev-legacy-ciphers@0.1.0.0/twofish.bend&name=tf.key