1
2
3
4
5
6
7
8
9
// XOR(x, y)
// If len(y) < len(x), wrap around inside y
pub fn xor_eq(x: &mut [u8], y: &[u8]) {
    let y_len = y.len();

    for i in 0..x.len() {
        x[i] ^= y[i % y_len];
    }
}