What you are looking at is a Caesar cipher
In cryptography, a Caesar cipher, also
known as a Caesar's cipher, the shift
cipher, Caesar's code or Caesar shift,
is one of the simplest and most widely
known encryption techniques. It is a
type of substitution cipher in which
each letter in the plaintext is
replaced by a letter some fixed number
of positions down the alphabet. For
example, with a shift of 3, A would be
replaced by D, B would become E, and
so on. The method is named after
Julius Caesar, who used it to
communicate with his generals.
This is a good way to start learning, but please read the section on Breaking the cipher
You could try something like
string val = "abc";
string encrypt = "";
for (int iChar = 0; iChar < val.Length; iChar++)
{
encrypt += (char)(val[iChar] + 3);
}
string decrypt = "";
for (int iChar = 0; iChar < encrypt.Length; iChar++)
{
decrypt += (char)(encrypt[iChar] - 3);
}
Another simple option to look at is
Simple XOR Encryption
What that means is that you only need
one method, "EncryptDecrypt". Pass a
string into it and get it back
encrypted. Pass the encrypted string
into it and you get back the original
text, as long as the XOR character is
the same.