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
caesarcipher(1) Manpage for caesarcipher caesarcipher(1)

caesarcipher - Caesar cipher cryptography tool

caesarcipher [-d|-e] [-p] [-s shiftvalue] [-i inputfile] [-o outputfile] [message ...]

caesarcipher 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:

ascii - print the ASCII table.
decrypt - enter a message to decrypt.
encrypt - enter a message to encrypt.
exit - exit caesarcipher.
help - print the command menu.
shifttable - print the current shift table.
shiftvalue - set a new shiftvalue.
spaces - turn preserve spaces on/off.
quit - quit caesarcipher (same as exit).

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.

-d, --decrypt
decrypt the message or inputfile
-e, --encrypt
encrypt the 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
-p, --preserve-spaces
preserve spaces when decoding/encoding
-s shiftvalue, --shiftvalue=shiftvalue
set the shiftvalue

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

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

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

Oliver Mahmoudi (contact@olivermahmoudi.com)
June 2020 caesarcipher 1.1

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.