Updated function to use existing fixed length XOR function