def xor_bytes
import bend-collections@1.0.0.0/spec/crypto/chacha.bend as Chachaimport Base
152# Byte-wise XOR of a block with the keystream (as long as the block).
153def xor_bytes(xs: List<&2, U32>, ks: List<&2, U32>) -> List<&2, U32>:
154 match xs ks:
155 case x <> xt k <> kt: U32.xor(x, k) <> xor_bytes(xt, kt)
156 case _ _: Nil{}