modification to xor with key