|
NAMEvigenere - Vigenere cipher cryptography toolSYNOPSISvigenere [-ht] [-o outputfile] -d|-e -s|cipherword messagevigenere [-ht] [-o outputfile] -d|-e -i inputfile -s|cipherword DESCRIPTIONvigenere is an implementation of the Vigenere cipher algorithm extended to the entire set of printable ASCII characters.Program Invocation: vigenere can be invoked in the following two forms: 1st Form: When invoked with either the -d or -e option and two other non-option arguments, the first non-option argument will be taken as the cipherword to use, whereas the second argument denotes the message to decrypt/encrypt. If upon invocation the -s option is also passed to the utility, then the user is asked to input the cipherword via the command line. User input will not be echoed. In this case, the first non-option command line argument resembles the message. 2nd Form: If the utility, next to being invoked with the -d or -e switch, also gets passed the -i switch, which requires a file to read from, then the first non-option argument represents the cipherword, unless overridden with the -s switch. OPTIONS
THEORYThe Vigenere cipher is a multi phase shift cipher, which works, by encrypting each letter of an original message with the corresponding letter of a freely chosen cipherphrase. Consider the Tabula Recta below.Tabula Recta:
| A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Suppose now, that the message to encrypt is: SECRET MESSAGE TO ENCODE along with the cipherphrase: TULIP To encrypt a message, it is first lined up with the cipherphrase, letter by letter. If the cipherphrase is shorter than the message to transform, then it is simply repeated until every letter of the message is covered. SECRET MESSAGE TO ENCODE
Actual encryption takes place, by finding the character, for which a pair of corresponding message- and cipherphrase letters intersect in the Tabula Recta. Whereas a message character is looked up in the leftmost column (message column), a cipherword letter is searched for in the topmost row (cipherword row). Horizontal- and vertical lines drawn from the characters positions on these axes, result in the encryped character. When performing these lookups for the above character pairs (coordinates), the encrypted message is: LYNZTM GPAHTAP BD XHNWSX To decrypt a message, knowledge of the cipherword is required. The encrypted message is aligned with the cipherword as if wanting to encrypt. However, instead of finding the point of intersection inside of the Tabula Recta, one now has to find the letters of the original message in the message column. This is done, by first locating the ciphersword's character of a given pair in the cipherword row. Once found, a perpendicular line is drawn downwards until the pair's encrypted character is encountered inside the Tabula Recta. When now drawing a horizontal line to the left from this character, one eventually reaches the decrypted character for the pair in the message column. By following these steps, one obtains the original message for the encrypted message above: LYNZTM GPAHTAP BD XHNWSX
gives: SECRET MESSAGE TO ENCODE The traditional Vigenere cipher only uses capital letters from A-Z, as in the example above. This implementation extends this notion to the entire set of displayable ASCII characters (Hex 20 - Hex 7E). The Vigenere cipher is named after Blaise de Vigenere (1523 - 1596). EXAMPLES1. Encrypt the message: "Hello world" with the cipherword "213" and write the result to stdout.vigenere -e 213 "Hello world" 2. Decrypt the message: (zo{u)Uyn$(vsnP)%Ln~w%pn using the word TULIP as a cipherphrase. vigenere -d TULIP '(zo{u)Uyn$(vsnP)%Ln~w%pn' 3. Encrypt the contents of file: ~/message.txt and write it to: ~/encrypted.txt. The cipherphrase is entered via the command line. vigenere -e -o ~/encrypted.txt -i ~/message.txt -s AUTHOROliver Mahmoudi (contact@olivermahmoudi.com)
Visit the GSP FreeBSD Man Page Interface. |