Caesar Cipher

The Caesar Cipher is also a substitution cipher. This was said to have been used by Julius Caesar to encode messages to his generals. In the classic Caesar cipher the letters are shifted 3 places to the right. The message "return to rome" would be encoded as "uhwxua wr urph". However, you can use any number of shifts. The following formula lets you shift 13 places to the right, wrapping the the letters as necessary.

newChar = chr ( ord ('a') + ( ord (oldChar) - ord ('a') + 13 ) % 26 )
Using this method the letter a will be replaced by the letter n , the letter b by the letter o and so on. By wrapping, the letters around would cause the letter z to be replaced by m.