def encrypt_blocks
bend-collections-laws-crypto@1.0.0.0 · spec/crypto/chacha.bend:158
import bend-collections-laws-crypto@1.0.0.0/spec/crypto/chacha.bend as Chacha
import Base
158
159def encrypt_blocks(bs: List<&2, List<&2, U32>>, +n: Nat, +key: List<&2, U32>, +counter: U32, +nonce: List<&2, U32>) -> List<&2, U32>:
160 match bs:
161 case Nil{}: Nil{}
162 case b <> rest:
163 List.append(&2, U32, xor_bytes(b, block_rounds(n, key, counter, nonce)),
164 encrypt_blocks(rest, n, key, U32.add(counter, 1), nonce))