All Topics  
Caesar cipher

 

   Email Print
   Bookmark   Link






 

Caesar cipher



 
 
In cryptography
Cryptography

Cryptography is the practice and study of hiding information. In modern times cryptography is considered a branch of both mathematics and computer science and is affiliated closely with information theory, computer security and engineering....
, a Caesar cipher, also known as a Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption
Encryption

In cryptography, encryption is the process of transforming information using an algorithm to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key ....
 techniques. It is a type of substitution cipher
Substitution cipher

In cryptography, a substitution cipher is a method of encryption by which units of plaintext are replaced with ciphertext according to a regular system; the "units" may be single letters , pairs of letters, triplets of letters, mixtures of the above, and so forth....
 in which each letter in the plaintext
Plaintext

In cryptography, plaintext is the information which the sender wishes to transmit to the receiver. Before the computer era, plaintext simply meant text in the language of the communicating parties....
 is replaced by a letter some fixed number of positions down the alphabet
Alphabet

An alphabet is a standardized set of letter basic written symbols each of which roughly represents a phoneme, a spoken language, either as it exists now or as it was in the past....
. For example, with a shift of 3, A would be replaced by D, B would become E, and so on.






Discussion
Ask a question about 'Caesar cipher'
Start a new discussion about 'Caesar cipher'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In cryptography
Cryptography

Cryptography is the practice and study of hiding information. In modern times cryptography is considered a branch of both mathematics and computer science and is affiliated closely with information theory, computer security and engineering....
, a Caesar cipher, also known as a Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption
Encryption

In cryptography, encryption is the process of transforming information using an algorithm to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key ....
 techniques. It is a type of substitution cipher
Substitution cipher

In cryptography, a substitution cipher is a method of encryption by which units of plaintext are replaced with ciphertext according to a regular system; the "units" may be single letters , pairs of letters, triplets of letters, mixtures of the above, and so forth....
 in which each letter in the plaintext
Plaintext

In cryptography, plaintext is the information which the sender wishes to transmit to the receiver. Before the computer era, plaintext simply meant text in the language of the communicating parties....
 is replaced by a letter some fixed number of positions down the alphabet
Alphabet

An alphabet is a standardized set of letter basic written symbols each of which roughly represents a phoneme, a spoken language, either as it exists now or as it was in the past....
. For example, with a shift of 3, A would be replaced by D, B would become E, and so on. The method is named after Julius Caesar
Julius Caesar

'Gaius Julius Caesar' , July 13, 100 BC ? March 15, 44 BC,) was a Roman Republic military and political leader. He played a critical role in the transformation of the Roman Republic into the Roman Empire....
, who used it to communicate with his generals.

The encryption step performed by a Caesar cipher is often incorporated as part of more complex schemes, such as the Vigenère cipher
Vigenère cipher

The Vigen?re cipher is a method of encryption alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of Polyalphabetic cipher....
, and still has modern application in the ROT13
ROT13

ROT13 is a simple substitution cipher used in online forums as a means of hiding spoiler s, punch line, puzzle solutions, and profanitys from the casual glance....
 system. As with all single alphabet substitution ciphers, the Caesar cipher is easily broken and in practice offers essentially no communication security.

Example

The transformation can be represented by aligning two alphabets; the cipher alphabet is the plain alphabet rotated left or right by some number of positions. For instance, here is a Caesar cipher using a left rotation of three places (the shift parameter, here 3, is used as the key
Key (cryptography)

In cryptography, a key is a piece of information that determines the functional output of a cryptographic algorithm or cipher. Without a key, the algorithm would have no result....
):

Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cipher: DEFGHIJKLMNOPQRSTUVWXYZABC

When encrypting, a person looks up each letter of the message in the "plain" line and writes down the corresponding letter in the "cipher" line. Deciphering is done in reverse.

Plaintext: the quick brown fox jumps over the lazy dog Ciphertext: WKH TXLFN EURZQ IRA MXPSV RYHU WKH ODCB GRJ

The encryption can also be represented using modular arithmetic
Modular arithmetic

In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers "wrap around" after they reach a certain value — the modulus....
 by first transforming the letters into numbers, according to the scheme, A = 0, B = 1,..., Z = 25. Encryption of a letter by a shift n can be described mathematically as,



Decryption is performed similarly,



(There are different definitions for the modulo operation
Modulo operation

In computing, the modulo operation finds the remainder of division of one number by another.Given two numbers, and , a modulo n is the remainder, on division of a by n....
. In the above, the result is in the range 0...25. I.e., if x+n or x-n are not in the range 0...25, we have to subtract or add 26.)

The replacement remains the same throughout the message, so the cipher is classed as a type of monoalphabetic substitution, as opposed to polyalphabetic substitution.

History and usage

Hw Caesar
The Caesar cipher is named after Julius Caesar
Julius Caesar

'Gaius Julius Caesar' , July 13, 100 BC ? March 15, 44 BC,) was a Roman Republic military and political leader. He played a critical role in the transformation of the Roman Republic into the Roman Empire....
, who, according to Suetonius
Lives of the Twelve Caesars

De vita Caesarum commonly known as The Twelve Caesars, is a set of twelve biographies of Julius Caesar and the first 11 Roman Emperor of the Roman Empire written by Suetonius....
, used it with a shift of three to protect messages of military significance. While Caesar's was the first recorded use of this scheme, other substitution ciphers are known to have been used earlier. His nephew, Augustus, also used the cipher, but with a right shift of one, and it did not wrap around to the beginning of the alphabet: There is evidence that Julius Caesar used more complicated systems as well, and one writer, Aulus Gellius
Aulus Gellius

Aulus Gellius , Latin author and grammarian, possibly of African origin, probably born and certainly brought up at Rome.He studied grammar and rhetoric at Rome and philosophy at Athens, after which he returned to Rome, where he held a judicial office....
, refers to a (now lost) treatise on his ciphers:

It is unknown how effective the Caesar cipher was at the time, but it is likely to have been reasonably secure, not least because most of Caesar's enemies would have been illiterate
Literacy

The traditional definition of literacy is considered to be the ability to read and write, or the ability to use language to Reading , Writing, Listening, and Speech communication....
 and others would have assumed that the messages were written in an unknown foreign language. Assuming that an attacker could read the message, there is no record at that time of any techniques for the solution of simple substitution ciphers. The earliest surviving records date to the 9th century works of Al-Kindi
Al-Kindi

, also known to the Western world by the Latinized version of his name 'Alkindus', was an Arab polymath: an Early Islamic philosophy, Islamic science, Islamic astrology, Islamic astronomy, Alchemy and chemistry in Islam, Logic in Islamic philosophy, Islamic mathematics, Arabic music, Islamic medicine, Islamic physics, Islamic psychologi...
 in the Arab
Arab

An Arab is a person who Identity as such on linguistic or cultural grounds. The plural form, Arabs , refers to the Ethnocultural group at large....
 world with the discovery of frequency analysis
Frequency analysis

In cryptanalysis, frequency analysis is the study of the letter frequencies or groups of letters in a ciphertext. The method is used as an aid to breaking classical ciphers....
.

A Caesar cipher with a shift of one is used on the back of the Mezuzah
Mezuzah

A mezuzah is a piece of parchment inscribed with specified Hebrew language verses from the Torah . These verses comprise the Jewish prayer "Shema", beginning with the phrase: "Listen, Israel, the Lord is our God, the Lord is One."...
 to encrypt the names of God
Names of God in Judaism

In Judaism, the name of God is more than a distinguishing title. It represents the Jewish conception of the divine nature, and of the relation of God to the Jewish people....
. This may be a holdover from an earlier time when Jewish people were not allowed to have Mezuzahs. The letters of the cryptogram themselves comprise a divine name which keeps the forces of evil in check.

In the 19th century, the personal advertisements section in newspapers would sometimes be used to exchange messages encrypted using simple cipher schemes. Kahn
David Kahn

David Kahn is a US historian, journalist and writer. He has written extensively on the history of cryptography and military intelligence.Kahn's first book was The Codebreakers , widely considered to be a definitive account of the history of cryptography up to the mid-1960s....
 (1967) describes instances of lovers engaging in secret communications enciphered using the Caesar cipher in The Times
The Times

The Times is a daily national newspaper published in the United Kingdom since 1785 when it was known as The Daily Universal Register.The Times and its sister paper The Sunday Times are published by Times Newspapers Limited, a subsidiary of News International....
. Even as late as 1915, the Caesar cipher was in use: the Russian army employed it as a replacement for more complicated ciphers which had proved to be too difficult for their troops to master; German and Austrian cryptanalysts had little difficulty in decrypting their messages.

Caesar ciphers can be found today in children's toys such as secret decoder ring
Secret decoder ring

A secret decoder was an inexpensive toy popular among young children from the 1930s through the rest of the 20th century. It was occasionally included as a toy prize in boxes of breakfast cereal and snack foods, such as Cracker Jack....
s. A Caesar shift of thirteen is also performed in the ROT13
ROT13

ROT13 is a simple substitution cipher used in online forums as a means of hiding spoiler s, punch line, puzzle solutions, and profanitys from the casual glance....
 algorithm
Algorithm

In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing....
, a simple method of obfuscating text widely found in UNIX
Unix

Unix is a computer operating system originally developed in 1969 by a group of American Telephone & Telegraph employees at Bell Labs, including Ken Thompson , Dennis Ritchie, Douglas McIlroy, and Joe Ossanna....
 and used to obscure text (such as joke punchlines and story spoilers
Spoiler (media)

A spoiler is a summary or description of a narrative that relates Plot elements not revealed early in the narrative itself. Moreover, because enjoyment of a narrative sometimes depends upon the dramatic tension and suspense which undergird it, this early revelation of plot elements can "spoil" the enjoyment that some consumers of the narrat...
), but not used as a method of encryption.

The Vigenère cipher
Vigenère cipher

The Vigen?re cipher is a method of encryption alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of Polyalphabetic cipher....
 uses a Caesar cipher with a different shift at each position in the text; the value of the shift is defined using a repeating keyword. If a single-use keyword is as long as the message and chosen randomly then this is a one-time pad
One-time pad

In cryptography, the one-time pad is an encryption algorithm where the plaintext is combined with a random key or "pad" that is as long as the plaintext and used only once....
 cipher, unbreakable if the users maintain the keyword's secrecy. Keywords shorter than the message (e.g., "Complete Victory
Vigenère cipher

The Vigen?re cipher is a method of encryption alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of Polyalphabetic cipher....
" used by the Confederacy
Confederate States of America

The Confederate States of America formed as the government set up from 1861 to 1865 by eleven Southern United States U.S. state of the United States of America that had declared their secession from the U.S....
 during the American Civil War
American Civil War

The American Civil War , also known as the War Between the States and several Naming the American Civil War, was a civil war in the United States....
), introduce a cyclic pattern that might be detected with a statistically advanced version of frequency analysis.

In April 2006, fugitive Mafia
Mafia

The Mafia is a Sicily criminal society which is believed to have emerged in late 19th century Sicily. It is a loose association of criminal groups that share a common organizational structure and code of conduct....
 boss Bernardo Provenzano
Bernardo Provenzano

Bernardo Provenzano is a member of the Sicily Mafia and is suspected of having been the head of the Corleonesi, a Mafia faction that originated in the village of Corleone, and de facto capo di tutti capi of the entire Sicilian Mafia until his arrest in 2006 after more than four decades on the run....
 was captured in Sicily
Sicily

Sicily is an Autonomous regions with special statute of Italy. Of all the regions of Italy, Sicily covers the largest land area at 25,708 km? and currently has just over five million inhabitants....
 partly because of cryptanalysis of his messages written in a variation of the Caesar cipher. Provenzano's cipher used numbers, so that "A" would be written as "4", "B" as "5", and so on.

Breaking the cipher

Decryption
shift
Candidate plaintext
0 exxegoexsrgi
1 dwwdfndwrqfh
2 cvvcemcvqpeg
3 buubdlbupodf
4 attackatonce
5 zsszbjzsnmbd
6 yrryaiyrmlac
...
23 haahjrhavujl
24 gzzgiqgzutik
25 fyyfhpfytshj
The Caesar cipher can be easily broken even in a ciphertext-only scenario
Ciphertext-only attack

In cryptography, a ciphertext-only attack or known ciphertext attack is an attack model for cryptanalysis where the attacker is assumed to have access only to a set of ciphertexts....
. Two situations can be considered:
  1. an attacker knows (or guesses) that some sort of simple substitution cipher has been used, but not specifically that it is a Caesar scheme;
  2. an attacker knows that a Caesar cipher is in use, but does not know the shift value.


In the first case, the cipher can be broken using the same techniques as for a general simple substitution cipher, such as frequency analysis
Frequency analysis

In cryptanalysis, frequency analysis is the study of the letter frequencies or groups of letters in a ciphertext. The method is used as an aid to breaking classical ciphers....
  or pattern words. While solving, it is likely that an attacker will quickly notice the regularity in the solution and deduce that a Caesar cipher is the specific algorithm employed.

English Slf
In the second instance, breaking the scheme is even more straightforward. Since there are only a limited number of possible shifts (26 in English), they can each be tested in turn in a brute force attack
Brute force attack

In cryptanalysis, a brute force attack is a method of defeating a cryptographic scheme by systematically trying a large number of possibilities; for example, a large number of the possible key s in a key space in order to decrypt a message....
. One way to do this is to write out a snippet of the ciphertext in a table of all possible shifts — a technique sometimes known as "completing the plain component". The example given is for the ciphertext "EXXEGOEXSRGI"; the plaintext is instantly recognisable by eye at a shift of four. Another way of viewing this method is that, under each letter of the ciphertext, the entire alphabet is written out in reverse starting at that letter. This attack can be accelerated using a set of strips prepared with the alphabet written down them in reverse order. The strips are then aligned to form the ciphertext along one row, and the plaintext should appear in one of the other rows.

Another brute force approach is to match up the frequency distribution of the letters. By graphing the frequencies of letters in the ciphertext, and by knowing the expected distribution of those letters in the original language of the plaintext, a human can easily spot the value of the shift by looking at the displacement of particular features of the graph. This is known as frequency analysis
Frequency analysis

In cryptanalysis, frequency analysis is the study of the letter frequencies or groups of letters in a ciphertext. The method is used as an aid to breaking classical ciphers....
. For example in the English language the plaintext frequencies of the letters E, T, (usually most frequent), and Q, Z (typically least frequent) are particularly distinctive. Computers can also do this by measuring how well the actual frequency distribution matches up with the expected distribution; for example, the chi-square statistic can be used.

For natural language plaintext, there will, in all likelihood, be only one plausible decryption, although for extremely short plaintexts, multiple candidates are possible. For example, the ciphertext MPQY could, plausibly, decrypt to either "aden
Aden

Aden is a city in Yemen, 170 kilometers east of Bab-el-Mandeb.Aden's ancient, natural harbour lies in the crater of an extinct volcano which now forms a peninsula, joined to the mainland by a low isthmus....
" or "know" (assuming the plaintext is in English); similarly, "ALIIP" to "dolls" or "wheel"; and "AFCCP" to "jolly" or "cheer" (see also unicity distance
Unicity distance

Unicity distance is a term used in cryptography referring to the length of an original ciphertext needed to break the cipher by reducing the number of possible spurious keys to zero in a brute force attack....
).

Multiple encryptions and decryptions provide no additional security. This is because two encryptions of, say, shift A and shift B, will be equivalent to an encryption with shift A + B. In mathematical terms, the encryption under various keys forms a group
Group (mathematics)

In mathematics, a group is an algebraic structure consisting of a set together with an Binary operation that combines any two of its element to form a third element....
.

Bibliography

  • David Kahn
    David Kahn

    David Kahn is a US historian, journalist and writer. He has written extensively on the history of cryptography and military intelligence.Kahn's first book was The Codebreakers , widely considered to be a definitive account of the history of cryptography up to the mid-1960s....
    , The Codebreakers — The Story of Secret Writing, 1967. ISBN 0-684-83130-9.
  • F.L. Bauer, Decrypted Secrets, 2nd edition, 2000, Springer. ISBN 3-540-66871-3.
  • Chris Savarese and Brian Hart, , 1999


External links

  • discussed on
  • showing all 25 possible codes for any given cipher