caesar - decrypt caesar ciphers


caesar [rotation]


caesar attempts to decrypt caesar ciphers using English letter frequency statistics. caesar reads from standard input and writes to standard output.

If the optional numeric argument rotation is used, caesar will rotate by that many letters. Otherwise caesar will try all 26 possible rotations and choose whichever seems most likely according to the frequency statistics.

Caesar ciphers involve rotating the letters in the input through the alphabet by a specified number. The original cipher, devised by Julius Caesar, involved a rotation of three letters; A becomes D, B becomes E, C becomes F, etc. A 13-letter rotation is often used in newsgroup postings.

The frequencies used in this implementation are:

    E 12.37, T 9.68, S 8.77, A 7.97, O 6.96, R 6.63, I 6.39, N 5.92,
    D  4.78, H 4.49, L 3.81, C 3.61, P 2.91, M 2.69, U 2.62, Y 2.07,
    F  2.01, W 1.88, G 1.46, B 1.35, V 0.81, K 0.42, X 0.23, Q 0.08,
    Z  0.06, J 0.04


This implementation of caesar has no known bugs.


This implementation of caesar in Perl was written by Ronald J Kimball, Based on caesar.c from the NetBSD games distribution, by Stan King and John Eldridge, which was based on an algorithm suggested by Bob Morris.


    $Log: caesar.ppt,v $
    Revision 1.2  2003/06/05 03:40:07  rjk
    minor improvements
    new email address
    Revision 1.1  2000/01/07 21:56:27  rjk
    Initial revision


This program is copyright 2000 by Ronald J Kimball.

This program is free and open software. You may use, modify, or distribute this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same.