pub fn xor_bytes(a: &[u8], b: &[u8]) -> Vec<u8> ⓘExpand description
XOR two byte slices into a new vector. Returns a vector with the XOR of each byte pair. If slices have different lengths, uses the shorter length.
§Examples
use chie_shared::xor_bytes;
// Basic XOR operation
let a = &[0xFF, 0x00, 0xAA];
let b = &[0xFF, 0xFF, 0x55];
assert_eq!(xor_bytes(a, b), vec![0x00, 0xFF, 0xFF]);
// Different lengths - uses shorter
let short = &[0xFF, 0x00];
let long = &[0xFF, 0xFF, 0xFF];
assert_eq!(xor_bytes(short, long), vec![0x00, 0xFF]);