Friday, April 22, 2011

Shift cipher or ceaser cipher


In cryptography, 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 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 shift of 3, A would be replaced by D, B would become E, and so on. The method is named after Julius Caesar, 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, and still has modern application in the ROT13 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):

Plain:    ABCDEFGHIJKLMNOPQRSTUVWXYZ
Cipher:   DEFGHIJKLMNOPQRSTUVWXYZABC
The encryption can also be represented by using modular arithmetic by first transforming the letters in to 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, 
E_n(x) = (x + n) \mod {26}.
Decryption is performed similarly,
D_n(x) = (x - n) \mod {26}.

There are different operations for the modulo operation. 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.
this kind of cipher is introduced by julius ceaser, a rome emporer


No comments:

Comments

blog comments powered by Disqus