in reply to Simple Encryption question

The ^ operator does bitwise XOR, and you're doing something called XOR encryption. Check the web for explanations on how it works.

In my experience, programs that need to "casually" encrypt some data will use this algorithm, because it is so simple to implement. For instance, I have a telnet program that stores configuration information (including the password) in a plain text file. It uses XOR encryption to encode the password in the file.

One of the biggest weaknesses of this method is that if you can get a hold of both the encrypted and the unencrypted version of a value, you can decode the key using XOR as well:
#!/usr/bin/perl $toBeEncrypted = "hi there"; $key = "nikos"; $encrypted = $toBeEncrypted ^ $key; print $encrypted ^ $toBeEncrypted; # Prints "nikos"