A list containing all printable characters, including numbers, punctuation, and whitespace is generated, called alphabet. For each character in the supplied plain text (or encrypted text, the program does not discriminate between the two) and the corresponding character in the supplied key, the indices of the characters' locations in the alphabet list are added. This sum (or difference, in the case of decryption) is then used to further indice the alphabet list and add the corresponding character to an ouput string. Newline characters are considered in this algorithm.
Spam
+ eggs
--------
68 41 26 50 = 'FqO}
Note that the } is generated from the newline character.
Python's string.printable is used to generate the list of printable characters.
Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum