A Very Brief Introduction to Cryptography.
Cryotography deals with the task of communicating secrets to those and only those with whom you want to share them with, while keeping them secret from everyone else. We start with a plaintext message, encrypt it and then transmit the ciphertext. The receiver then decrypts the ciphertext to recover the plaintext message.
One of the oldest and simplest encryption systems is the Caesar cipher. Imagine two concentric rings, each enscribed with a copy of the alphabet with each letter in the same corresponding position. Rotate the inner ring by an amount agreed to by the sender and the receiver. Then for each letter in the plaintext, find the letter on the outer ring and write down the corresponding letter on the inner ring. As long as your alphabet is realtively small, the Caesar cipher can be implemented physically as just described.
A variation of the Caesar cipher that has been used on the Usenet to encrypt punch lines on jokes is the Rot13 cipher. This rotates the 26 letters of the lower case alphabet by 13 letters, the 26 letters of the uppercase alphabet by 13 letters, and leaves digits and punctuation alone. Note that applying Rot13 a second time restores the plaintext.
For an excellent introduction to these topics check out William Stein's book, "Elementary Number Theory: Primes, Congruences, and Secrets".
The following blocks and exercises will provide basic encryption and decryption functions, which implement Rot13 and provide programming examples that can be useful in more elaborate cryptographic projects.