pgm 22.5, xor encryption with file IO