|
NAMEcaesarcipher - Caesar cipher cryptography toolSYNOPSIScaesarcipher [-d|-e] [-p] [-s shiftvalue] [-i inputfile] [-o outputfile] [message ...]DESCRIPTIONcaesarcipher is an implementation of the Caesar cipher encryption algorithm extended to the entire set of printable ASCII characters.Program Invocation: caesarcipher can be invoked in the following three forms: 1st Form: If invoked with no arguments, other than a possible shiftvalue -s or the -p option, the user is placed into a shell like command line enviroment, in which he can enter messages to be encrypted or decrypted. The "caesarcipher shell" which identifies itself by: cc> understands the following commands:
2nd Form: In this form, the utility is invoked with either the -d or -e switch, a given shift value -s to encrypt or decrypt messages passed via the command line. 3rd Form: If the message to be processed is inside a file, then caesarcipher can, alongside the -d or -e switches, be invoked with the -i option, which takes an associated inputfile argument. If -o outputfile is specified as well, then the encoded/decoded message is written to the outputfile. Otherwise the message is written to stdout. OPTIONS
THEORYThe cipher works by shifting the characters in the original message by a certain number, thus creating a new - encrypted - message.Take for example the letters from A-Z (original alphabet), and another alphabet (shifted alphabet), in which each letter has been shifted by the number 5 (shiftvalue): Original Alphabet: Shifted Alphabet:
Suppose now, that the message to encrypt is: THIS IS THE SECRET MESSAGE By making use of the above table, every character of the original message can be mapped to its corresponding character in the shifted alphabet. The encrypted message therefore becomes: YMNX NX YMJ XJHWJY RJXXFLJ To decrypt a message, knowledge of the shiftvalue (encryption key) is required. Decryption works by reverse shifting (subtracting) the given encryption key from every letter, thus obtaining the original message. Whereas the classical Caesar cipher only uses capital letters from A-Z, as in the example above, this implementation is capable of transforming all displayable ASCII characters (Hex 20 - Hex 7E). Note however, that caesarcipher should not be used for serious encryption purposes, as the algorithm is not inherently safe. The Caesar cipher is named after Julius Caesar (100 BC - 44 BC). EXAMPLES1. Encode the message: "Secret Message" with a shift value of 21 and write it to stdout.caesarcipher -e -s 21 "Secret Message" 2. Decode the string "123456789" with a shift value of 1. caesarcipher -d -s 1 123456789 3. Encode the contents of file orig.txt with a shift value of -179 and preserve spaces. Write the result to encrypted.txt. caesarcipher -e -s -179 -p -i ~/orig.txt -o ~/encrypted.txt AUTHOROliver Mahmoudi (contact@olivermahmoudi.com)
Visit the GSP FreeBSD Man Page Interface. |