Caesar cipher

10
1 Caesar Cipher

Transcript of Caesar cipher

Page 1: Caesar cipher

1

Caesar Cipher

Page 2: Caesar cipher

Caesar CipherCaesar Cipher In cryptography, a Caesar cipher, also known as Caesar's cipher,

the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques.

It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet.

For example, with a left shift of 1, A would be replaced by B, C would become D, and so on. The method is named after Julius Caesar, who used it in his private correspondence.

Caesar cipher is often incorporated as part of more complex alorithm, such as the Vigenère cipher, and still has modern application in the ROT13 system. However it has no communication security, and it can be easily broken even by hand.

Page 3: Caesar cipher

Caesar Cipher: Mathematical Caesar Cipher: Mathematical BaseBase

The encryption can also be represented using modular arithmetic by first transforming the letters into numbers, according to the scheme, A = 0, B = 1,..., Z = 25.

Encryption of a letter x by a shift n can be described mathematically as

Decryption can be described mathematically as

En (x)= (x+n) mod 26

Dn (x)= (x-n) mod 26

Page 4: Caesar cipher

Caesar Cipher: Mathematical Caesar Cipher: Mathematical BaseBase

Encryption

Decryption

Page 5: Caesar cipher

Caesar Cipher: ExampleCaesar Cipher: Example

To pass an encrypted message from sender to receiver, it is first necessary that both parties have the 'key' for the cipher. So that the sender may encrypt it and the receiver may decrypt it.

For the caesar cipher, the key is the number of characters to shift the cipher alphabet.

Here is a quick example of the encryption and decryption steps involved with the caesar cipher. The text we will encrypt is 'defend the east wall of the castle', with a shift (key) of 1.

Page 6: Caesar cipher

Caesar Cipher: ExampleCaesar Cipher: Example

Page 7: Caesar cipher

Caesar Cipher: ExampleCaesar Cipher: Example Encryption: using single shift (shift key=1)

It is easy to see how each character in the plaintext is shifted up the alphabet. Decryption is just as easy, by using an offset of -1.

Decryption:

plaintext: defend the east wall of the castleciphertext: efgfoe uif fbtu xbmm pg uif dbtumf

plaintext: defend the east wall of the castleciphertext: efgfoe uif fbtu xbmm pg uif dbtumf

ciphertext: efgfoe uif fbtu xbmm pg uif dbtumfplaintext: defend the east wall of the castle

ciphertext: efgfoe uif fbtu xbmm pg uif dbtumfplaintext: defend the east wall of the castle

Page 8: Caesar cipher

WeaknessesWeaknesses The Caesar cipher can be easily broken even in a ciphertext-only

scenario. Two situations can be considered:

1. an attacker knows (or guesses) that some sort of simple substitution cipher has been used.

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 or pattern words

In the second instance, breaking 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.

Solution: use multiple shift keys. Shift by 3,5 and 7

Page 9: Caesar cipher

ReferencesReferences http://en.wikipedia.org/wiki/ Applied Cryptography by Bruce Schneier; 10th Anniversary

edition

Page 10: Caesar cipher

10

Md. Shakhawat HossainStudent of Department of Computer Science & EngineeringUniversity of RajshahiE-mail: [email protected]