Using XOR algorithm