On his blog today, Joshua Houle has posted a tutorial that looks at some simple encrpytion/decryption functions that he's whipped up for his everyday use.
Our first function is our encryption function called createsecretmessage. It takes two arguments, the message we want to encrypt and the key. The second function is the decryption function. It also takes two arguements, the encrypted message and the key.
Before he even gets into the code, he explains how the encryption portion of it works, complete with a chart representing the encryption process. Following this,the two functions are explained, each with their own code to make cut and paste simple.