Check this out http://www.go4expert.com/articlesamples/php_xor_cipher/, I've added an additional base64 encoding of the ciphertext 'cause it generates some binary data!