If I'm understanding the problem correctly, you essentially want to build a simple encryption/decryption program that will encrypt a string with a key and also be able to get the original string back with the same key - is that right?
If so, there are probably a lot of ways to do this, but this...