Cryptography | Caesar | Vigenere | Vernam | Columnar
Monday, 13 December 2010
, Posted by genesisdatabase at 10:47
[code]
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
[/code]
Always remember that the character A-Z starts from 0 and ends at 25 and not from 1 to 26!
Caesar cipher
Alright i am pretty sure we all know that we move it forward by 3 characters. So to encrypt the character A (or numeric 0) + 3 would be D (or numeric 3). Caesar cipher reference.
Look into some Caesar and Rot13 source codes (C language) here.
Vernam cipher
Basically this is simple, it is taught to convert that character A-Z into numeric 0-25 and add them with a random number and mod it into 26 and we get it right? So the formula should be something like the code below for encryption process.
[code]
Ci = Pi + Ri (mod 26)
C = Cipher Text
P = Plain Text
R = Random
[/code]
Note that what was taught in the class was not complete. A vernam cipher generally requires the length of the original data and the length of the key to be the same. We were given an example of an image below.
Generally the example is not wrong but there would be no decryption process possible here. As we have only 26 characters in the alphabetical table and the key 105 appeared, the encryption process made decryption impossible. However as the lecturer has mentioned we are only concerned about encrypting the plain text only, so remember the encryption algorithm.
Vigenere cipher
Vigenere cipher is not that hard to encrypt and decrypt. For your information, looking into alphabetic table is not a necessary tool. A cipher always exists with an algorithm (as far as i'm concerned, i might not be right). Be amazed with vigenere cipher's algorithm.
[code]
Ci = Pi + Ki (mod 26)
Pi = Ci - Ki (mod 26)
P = Plain Text
K = Key
C = Cipher Text
[/code]
If you're having calculation problem with this, please do post it as a comment so i could help. It's quite a hassle to do all of them in an example. However you can see that to encrypt the character A with the key L it would be A + L = 0 + 11 = 11 (L). You may also see that Vigenere cipher and Vernam cipher is pretty much the same thing, only that the reason they were made for was different.
Columnar cipher
[code]
T h i s i
s a m e s
s a g e
[/code]
From the above, "This is a message" was written in a 5 x 3 block. All you have to do in order to encrypt using columnar cipher is to place them in x * y block whereby x is 5 and y would end when the message to encrypt ends. After that read the text from top to bottom, left to right to get the cipher text. The message encrypted would be "tssha aimgs eeis".
This post was made to aid those that have cryptography problem which was related to an exam for my subject.
Currently have 0 comments: