Thread: XOR Encryption
View Single Post
  #6  
Old 08-17-2008, 02:15 AM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
I just did a simple test, and there's something wrong with this code (I'm not sure what it is). XOR ciphers are solvable via (plaintext) XOR (ciphertext), meaning if I encrypt the encrypted text using the same key, I should get the original text.

PHP Code:
function test() {
  
temp.XOREncrypt("test string"truenull);
  
temp.XOREncrypt(temp.atruenull);
  echo(
temp.a);
  echo(
temp.b);

Returns:
PHP Code:
5'00e53:-$,
test-strdng 
It seems that it's always 1 letter off.

Correct me if I'm wrong.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote