Fix xor_key implementation and usage, did not think through the logic at 4AM at night.