change algorithm to XOR