GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
vigenere(1) Manpage for vigenere vigenere(1)

vigenere - Vigenere cipher cryptography tool

vigenere [-ht] [-o outputfile] -d|-e -s|cipherword message
vigenere [-ht] [-o outputfile] -d|-e -i inputfile -s|cipherword

vigenere 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.

-d, --decrypt
decrypt message or inputfile
-e, --encrypt
encrypt message or inputfile
-h, --help
print a help message and exit
-i inputfile, --inputfile=inputfile
read from inputfile
-o outputfile, --outputfile=outputfile
write to outputfile
-s, --secret-phrase
enter the cipherphrase unechoed via the command line
-t, --tabula-recta
print the Tabula Recta to stdout and exit

The 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
--------------------------------------------------------- A | 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 B | 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 A C | C D E F G H I J K L M N O P Q R S T U V W X Y Z A B D | E F G H I J K L M N O P Q R S T U V W X Y Z A B C C E | E F G H I J K L M N O P Q R S T U V W X Y Z A B C D F | F G H I J K L M N O P Q R S T U V W X Y Z A B C D E G | G H I J K L M N O P Q R S T U V W X Y Z A B C D E F H | H I J K L M N O P Q R S T U V W X Y Z A B C D E F G I | I J K L M N O P Q R S T U V W X Y Z A B C D E F G H J | J K L M N O P Q R S T U V W X Y Z A B C D E F G H I K | K L M N O P Q R S T U V W X Y Z A B C D E F G H I J L | L M N O P Q R S T U V W X Y Z A B C D E F G H I J K M | M N O P Q R S T U V W X Y Z A B C D E F G H I J K L N | N O P Q R S T U V W X Y Z A B C D E F G H I J K L M O | O P Q R S T U V W X Y Z A B C D E F G H I J K L M N P | P Q R S T U V W X Y Z A B C D E F G H I J K L M N O Q | Q R S T U V W X Y Z A B C D E F G H I J K L M N O P R | R S T U V W X Y Z A B C D E F G H I J K L M N O P Q S | S T U V W X Y Z A B C D E F G H I J K L M N O P Q R T | T U V W X Y Z A B C D E F G H I J K L M N O P Q R S U | U V W X Y Z A B C D E F G H I J K L M N O P Q R S T V | V W X Y Z A B C D E F G H I J K L M N O P Q R S T U W | W X Y Z A B C D E F G H I J K L M N O P Q R S T U V X | X Y Z A B C D E F G H I J K L M N O P Q R S T U V W Y | Y Z A B C D E F G H I J K L M N O P Q R S T U V W X Z | Z 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

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
TULIPT ULIPTUL IP TULIPT

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
TULIPT ULIPTUL IP TULIPT

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).

1. 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

Oliver Mahmoudi (contact@olivermahmoudi.com)
June 2020 vigenere 1.0

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.