English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2 answers

That is not enough ciphertext to do a Vigenere decryption -- you need several hundred characters. It would be adequate for simple substitution.

2007-02-17 19:44:11 · answer #1 · answered by Anonymous · 0 0

The Vigenere Cipher Applet shown here on this web page is capable of encrypting and decrypting a message using the Vigenere algorithm as well as breaking or finding the key for a message encrypted using that algorithm.



The only restriction this applet has is that only letters may be used for the plaintext message, the ciphertext, and the key. Using any other characters such as punctuation and numbers will cause the applet to function improperly. Spaces or uppercase letters may be used. The applet will strip the message of any spaces and convert uppercase letters to lowercase letters before encrypting, decrypting, or breaking the message.



Encrypting a message


To encrypt a message:



1) Make sure that the plaintext message contains only letters and spaces -- no punctuation, numbers, or other characters.

2) Enter the message into the “PlainText:” text field.

3) Choose a key consisting of only letters -- no punctuation, numbers, or other characters.

4) Enter the key into the “Key:” text area.

5) Click on the “Encrypt” button to encrypt the message. The encrypted message will appear in the “CipherText:” text field.



For more information about encrypting a plaintext message, see the section called “Encryption & Decryption Explained.”



Decrypting a message


To decrypt a message:



1) Make sure that the ciphertext message contains only letters and spaces -- no punctuation, numbers, or other characters.

2) Enter the message into the “CipherText:” text field.

3) Make sure the key contains only letters and spaces -- no punctuation, numbers, or other characters.

4) Enter the key into the “Key:” text area.

5) Click on the “Decrypt” button to decrypt the message. The decrypted message will appear in the “PlainText:” text field.



For more information about decrypting a plaintext message, see the section called “Encryption & Decryption Explained.”



Breaking / Finding Key(s) for a message


To break a message:



1) Make sure that the ciphertext message contains only letters and spaces -- no punctuation, numbers, or other characters.

2) Enter the message into the “CipherText:” text field.

3) Choose the number of keys to be returned by the applet. (Note: Selecting “0” will return all the possible keys. However, this is not recommended because depending on the browser used, the applet may throw an exception and no keys may ever be returned. If a long time has passed and no keys have been returned, simply choose a different number and try again. Asking the applet to return 25-30 keys should be sufficient.)

4) Enter the number into the “# of Keys to Return:” number area.

5) Click on the “Break / Find Key(s)” button. The keys will appear in the “Possible Keys:” text field.

6) Choose one of the keys from the “Possible Keys:” text field. Each key is displayed on a line.

7) Enter the key into the “Key:” text area.

8) Click on the “Decrypt” button to decrypt the message. The decrypted message will appear in the “PlainText:” text field.

9) Check to see if the message makes sense. If not, repeat from step 6. If so, then the chosen key is the correct key. (Note: In some cases, the correct key may not be found by the applet. See the section called “Break Explained.”)



For more information about breaking or finding the key(s) for an encrypted message, see the section called “Break Explained.”



Clearing the display


To clear the applet’s display area, click on the “Clear” button.



Sample plaintext


A few sample plaintext messages are provided for the user to help him or her get started on a demo. They are not necessary for the applet to function properly.



Clicking on the “Sample Plaintext #1” button will clear the “CipherText:” text field and place the following plaintext message into the “PlainText:” text field:



Holmes had been seated for some hours in silence with his

long thin back curved over a chemical vessel in which he

was brewing a particular lymal odorous product His head

was sunk upon his breast and he looked from my point of

view like a strange lank bird with dull grey plumage and

a black top knot So watson said he suddenly you do not

propose to invest in south african securities



Clicking on the “Sample Plaintext #2” button will clear the “CipherText:” text field and place the following plaintext message into the “PlainText:” text field:



The method used for the preparation and reading of code

messages is simple in the extreme and at the same time

impossible of translation unless the key is known The ease

with which the key may be changed is another point in favor

of the adoption of this code by those desiring to transmit

important messages without the slightest danger of their

messages being read by political or business rivals etc



Clicking on the “Sample Plaintext #3” button will clear the “CipherText:” text field and place the following plaintext message into the “PlainText:” text field:



Here is how it works



Sample ciphertext


A few sample ciphertext messages are provided for the user to help him or her get started on a demo. They are not necessary for the applet to function properly.



Clicking on the “Sample Ciphertext #1” button will clear the “PlainText:” text field and place the following ciphertext message into the “CipherText:” text field and its corresponding key into the “Key:” text area:



ocwyikoooniwugpmxwktzdwgtssayjzwyemdlbnqaaavsuwdvbrflauplo

oubfgqhgcscmgzlatoedcsdeidpbhtmuovpiekifpimfnoamvlpqfxejsm

xmpgkccaykwfzpyuavtelwhrhmwkbbvgtguvtefjlodfefkvpxsgrsorvg

tajbsauhzrzalkwuowhgedefnswmrciwcpaaavogpdnfpktdbalsisurln

psjyeatcuceesohhdarkhwotikbroqrdfmzghgucebvgwcdqxgpbgqwlpb

daylooqdmuhbdqgmyweuik



holmes



Clicking on the “Sample Ciphertext #2” button will clear the “PlainText:” text field and place the following ciphertext message into the “CipherText:” text field and its corresponding key into the “Key:” text area:



vvhqwvvrhmusgjgthkihtssejchlsfcbgvwcrlryqtfsvgahwkcuhwauglq

hnslrljshbltspisprdxljsveeghlqwkasskuwepwqtwvspgoelkcqyfnsv

wljsniqkgnrgybwlwgoviokhkazkqkxzgyhcecmeiujoqkwfwvefqhkijrc

lrlkbienqfrjljsdhgrhlsfqtwlauqrhwdmwlgusgikkflryvcwvspgpmlk

assjvoqxeggveyggzmljcxxljsvpaivwikvrdrygfrjljslveggveyggeia

puuisfpbtgnwwmuczrvtwglrwugumnczvile



codes



Clicking on the “Sample Ciphertext #3” button will clear the “PlainText:” text field and place the following ciphertext message into the “CipherText:” text field and its corresponding key into the “Key:” text area:



citxwjcsybhnjvml



vector



Miscellaneous


This applet was developed for ECE 575, Data Security & Cryptography, at Oregon State University during Winter Term 2002.




-------------------------------------------------------------------------------


--------------------------------------------------------------------------------

Vigenere Cipher Encryption and Decryption Algorithms Explained

Caesar Cipher



The Vigenere Cipher is a variation of the Caesar Cipher also known as a shift cipher. A Caesar Cipher takes the letters of the alphabet and shifts them the number of spaces that the key requires. The alphabet is numbered from 0 to 25. The alphabet table and its corresponding numbers are shown below.



a
b
c
d
e
f
g
h
i
j
k
l
m

0
1
2
3
4
5
6
7
8
9
10
11
12

n
o
p
q
r
s
t
u
v
w
x
y
z

13
14
15
16
17
18
19
20
21
22
23
24
25


Table 1: Alphabet table and corresponding numbers.



You then choose a key. The key is an integer k with 0 £ k £ 25. This can also correspond to a letter. The ciphertext c is produced by the plaintext p by, c = p + k (mod 26). If the plaintext letter was c and the key was 3 the ciphertext would be 2 + 3 = 5 = f. For example, say you wanted to send a message to someone, but you didn’t want others, who saw it, to be able to read it. You could decide to shift all the letters three places in the alphabet. The message and the ciphertext is shown below.



Plaintext: This is an example of the Caesar cipher

Ciphertext: wklvlvdqhadpsohriwkhfdhvduflskhu



All the letters have been changed and are not easily discernable. The Caesar Cipher is an easy encryption method, but is also very easy to break. By testing all 26 combinations you would be able to find the message.



Vigenere Cipher


The Vigenere Cipher like the Caesar Cipher shifts letters, but unlike the Caesar Cipher it is not easily broken in 26 combinations. The Vigenere Cipher uses a multiple shift method. The key is not just one shift, but several shifts. The key is several integers ki with 0 £ ki £ 25. The key could look like, k = (21, 4, 2 19, 14, 17). This would shift the fist letter 21, c1 = p1 + 21 (mod 26), and the second letter 4, c2 = p2 + 4 (mod 26), and so on until you reach the end of the key and then start over again. The key is usually a word, making it easier to remember, like the key above corresponds to the word “vector”. The multiple shift key method gives added protection for two reasons. The first reason is that others do not know the length of the key. The second reason is that the number of possible solutions has increased. For example if the key length = 5 the number of combinations that would be required for en exhaustive search would be 26^5 = 11,881,376. The Vigenere Cipher has been broken using other than an exhaustive search. For more information on breaking the Vigenere Cipher see “Breaking the Vigenere Cipher Explained”. An example of the Vigenere Cipher is shown below.



Plaintext: This is an example of the Vigenere cipher

Key: vector

Ciphertext: olklwjvrgqodkpghtkcixbuviitxqzklgk



Decryption


The decryption method used for the Vigenere Cipher is similar to the encryption method. The difference is that you subtract the key from the ciphertext, pi = ci - ki (mod 26). An example is shown below.



Ciphertext: olklwjvrgqodkpghtkcixbuviitxqzklgk

Key: vector

Plaintext: thisisanexampleoftheVigenerecipher



All that is left to do now is insert the spaces to make things easily read.



Equations



Encryption:

The key is several integers ki with 0 £ ki £ 25.

K = (k1, k2, k3, … , ki)

The length of the key is optional.

ci = pi + ki (mod 26).



Decryption:

The key must be known.

pi = ci - ki (mod 26).



--------------------------------------------------------------------------------

Breaking the Vigenere Cipher Explained

Overview


The Vigenere Cipher is a variation of the shift cipher. The main difference is that while a shift cipher encrypts a plaintext message one letter at a time, the Vigenere Cipher encrypts one block or a set amount of letters at a time. The key length determines the block size. Since the Vigenere Cipher is a variation of the shift cipher, we are able to use a variation of the frequency count attack to find the key and break the algorithm.



Using this attack method, the Vigenere Cipher Applet generates a list of possible keys for the user to use to decrypt the ciphertext. On average, the correct key is found within the first 25-30 keys listed. However, there are occasions where the correct key may not be one of the first 30 or one of the listed keys. See the subsection called “Weaknesses” for an explanation.



Frequency count attack


A frequency count attack exploits the fact that in the English language some letters occur more frequently than others (the frequencies of letters are not equal). For example, the letter “e” occurs much more frequently than the letter “z.” The table below shows the frequencies of letters in the English language (reproduced from Trappe, Wade and Washington, Lawrence; Introduction to Cryptography with Coding Theory; 2002, Prentice Hall, Upper Saddle River, NJ).





Table 1 – Frequency of English Letters



So assuming the plaintext message was written in English, someone using the frequency count attack would take the ciphertext and count the occurrence of all the letters. Then using the knowledge about the frequency of letters in the English language, that person could concluded that the most frequent letter in the ciphertext would correspond to the letter “e” in the English language and so forth, thus, decrypting the message.



However, this is easier said than done. Problems arise when the counts of letters are similar to one another or there is not enough ciphertext to get an accurate count of the frequencies of letters. When this happens, the guess for which ciphertext letters match to which English letters has a higher chance of being incorrect. As a result, the frequency count attack is only useful for shift ciphers and some variations of shift ciphers where the frequencies between letters are vastly different from one another.



Step 1 – finding the key length


To find the key length, we count the number of occurrences of letters that match when comparing the ciphertext to itself shifted by a displacement (the potential key length). For example, if the ciphertext is the ciphertext obtained from clicking the “Sample Ciphertext #1” button and we perform the comparison for a displacement of 3:



ocwyikoooniwugpmxwktzdwgtssayjzwy

ocwyikoooniwugpmxwktzdwgtssayjzwyemd





emdlbnqaaavsuwdvbrflauplooubfgqhg

lbnqaaavsuwdvbrflauplooubfgqhgcsc

*



cscmgzlatoedcsdeidpbhtmuovpiekifp

mgzlatoedcsdeidpbhtmuovpiekifpimf

* * * *



imfnoamvlpqfxejsmxmpgkccaykwfzpyu

noamvlpqfxejsmxmpgkccaykwfzpyuavt





avtelwhrhmwkbbvgtguvtefjlodfefkvp

elwhrhmwkbbvgtguvtefjlodfefkvpxsg





xsgrsorvgtajbsauhzrzalkwuowhgedef

rsorvgtajbsauhzrzalkwuowhgedefnsw

* *



nswmrciwcpaaavogpdnfpktdbalsisurl

mrciwcpaaavogpdnfpktdbalsisurlnps

*



npsjyeatcuceesohhdarkhwotikbroqrd

jyeatcuceesohhdarkhwotikbroqrdfmz





fmzghgucebvgwcdqxgpbgqwlpbdaylooq

ghgucebvgwcdqxgpbgqwlpbdaylooqdmu

*



dmuhbdqgmyweuik

hbdqgmyweuik



We have nine coincidences. If we were to continue on for all the possible displacements (1 to 311), we find that the highest number of coincidences occur for a displacement of 6. So this would be our guess for the key length.



Step 2 – finding the key


After finding the key length, we need to find the frequency of letters in the ciphertext. We need to create tables similar to Table 1, and do this by counting the frequency of every nth letter (n is determined by the key length) and dividing those counts by the total number of letters we counted.



Continuing with our example, since we have a key length of six, we will make six tables. For the first table, start with the first letter in the ciphertext and count the frequencies of every sixth letter (count the frequency of letter 1, then 7, then 13 etc.). For the second table, start with the second letter in the ciphertext and count the frequencies of every sixth letter (count the frequency of letter 2, then 8, then 14 etc.). This is done until we have six tables (W1-W6). The last table is as follows:





Table 2 – The 6th Table



These six tables will help us determine each of the six letters in the key. But before we can do so, we need to also create a table of frequencies for each of the letters in the English alphabet (a total of 26: A1-A26). Table 1 is the table for the letter “a.” To get the table for the rest of the letters, we simply shift the values in Table 1 to the right by the appropriate amount. For example, to get the table for the letter “c,” we would shift the values in Table 1 by two. The table for “c” would be:





Table 3 – Frequency Table for the Letter “c”



After obtaining these 26 tables, we write all our tables as vectors and take the dot product of each of the W’s with the A’s. The example below is taking W1 dot all the A’s. We will need to take each W and dot them with all the A’s.



W1 dot A1 = WA1

W1 dot A2 = WA2

.

.

.

W1 dot A26 = WA26



The highest value from the dot product will be the letter for that particular spot in the key. Using our example, W6 dot all the A’s give us the following:



W6 dot A1 = 0.0313 (Table for “a”)

W6 dot A2 = 0.0329 (Table for “b”)

W6 dot A3 = 0.0523 (Table for “c”)

W6 dot A4 = 0.0472 (Table for “d”)

W6 dot A5 = 0.0258 (Table for “e”)

W6 dot A6 = 0.0329 (Table for “f”)

W6 dot A7 = 0.0491 (Table for “g”)

W6 dot A8 = 0.0392 (Table for “h”)

W6 dot A9 = 0.0310 (Table for “i”)

W6 dot A10 = 0.0325 (Table for “j”)

W6 dot A11 = 0.0398 (Table for “k”)

W6 dot A12 = 0.0301 (Table for “l”)

W6 dot A13 = 0.0384 (Table for “m”)

W6 dot A14 = 0.0358 (Table for “n”)

W6 dot A15 = 0.0404 (Table for “o”)

W6 dot A16 = 0.0395 (Table for “p”)

W6 dot A17 = 0.0348 (Table for “q”)

W6 dot A18 = 0.0372 (Table for “r”)

W6 dot A19 = 0.0637 (Table for “s”)

W6 dot A20 = 0.0386 (Table for “t”)

W6 dot A21 = 0.0274 (Table for “u”)

W6 dot A22 = 0.0348 (Table for “v”)

W6 dot A23 = 0.0485 (Table for “w”)

W6 dot A24 = 0.0294 (Table for “x”)

W6 dot A25 = 0.0417 (Table for “y”)

W6 dot A26 = 0.0467 (Table for “z”)



The highest value is 0.0637, which is W6 dot A19 or the table for “s.” So the 6th letter in our key is the letter “s.” Using this process to find the rest of the letters in the key will yield “holmes” as the key.



So by using a variation of the frequency count attack, we have been able to find the key for “Sample Ciphertext #1.”



Weaknesses


The variation of the frequency count attack used to break the Vigenere Cipher also has problems similar to that of the regular frequency count attack. The ratio of the ciphertext to the key length must be sufficiently large. In other words, there has to be enough ciphertext to count the frequencies. Otherwise the correct key will not be found. This can be tested using “Sample Plaintext #3,” and encrypting it with the key “vector.” The applet will not be able to find the correct key because there is not enough ciphertext. The same test can be done using any of the other sample plaintext. Just pick a key length that is large. This weakness occurs in step 2 of the break algorithm.



This break algorithm also has a weakness in step 1. The highest coincidence count should give the length of the key. However, this is not always the case. The error is in relation to the assumption we made concerning the English language. We assumed that the highest frequency would naturally be the letter “e” because the letter “e” occurs the most in the English language. However, this is not always true. There are occasions where a block of text will not have “e” as the most frequent letter. The same exception exists when we assume that the highest coincidence count will give us the length of the key. There are occasions when it will not. Just like there are occasions when “e” is not the most frequent letter.



The applet handles the weakness in step 1 by providing a list of possible keys. The keys are listed from most likely to least likely. The applet, however, does not handle the weakness in step 2. If there is not enough ciphertext to perform an accurate frequency count, the letters in the key will not be found, even if the key length is found and correct. In general, the correct key will be found in the first 25-30 keys listed.

2007-02-18 03:46:15 · answer #2 · answered by jithu k 2 · 0 0

fedest.com, questions and answers