Welcome Guest [Log In] [Register]
Welcome to Crypto. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Announcement: Official Vigenčre Tutorial
Topic Started: Oct 6 2005, 02:30 PM (1,008 Views)
Revelation
Member Avatar
Administrator
[ *  *  *  *  * ]
Since the major success of Donald's Vigenčre tips, I have decided to make an official one together with you. This will be posted (and pinned) in the General section of Cryptanalysis. I will soon post a first version. :)
RRRREJMEEEEEPVKLWENFNVJKEEEEEAOLKAFKLXCFZAASDJXZTTTTTTTLSIOWJXMOKLAFJNNKFNXN
RAGRBAQEMHIGDJVDSEOXVIYCELFHWLELJFIENXLRATALSJFSLCYTKLASJDKMHGOVOKAJDNMNUITN
RRRRLJVEEEEECLYVYHNVPFTAEEEEEMWLMEIRNGLARWJAKJDFLWNTIERJMIPQWOTZEOCXKNUBNXCN
RJIRPOWEANFUSNCZVDVZNMSFEKLOEPZLDKDJWSAAAAAAAOERHJCTNCKFRIMVKSOFOMKMANREWNBN
RZUDRGXEEEEENFQIDVLQNCKNEEEEEDGLLLLLLAWIOSNCDARLODMTOEJXMILDFJROTKJSDNLVCZNN
Offline Profile Quote Post Goto Top
 
Revelation
Member Avatar
Administrator
[ *  *  *  *  * ]
Well, this is version one. It contains some background info, but no cracking methods yet. Feel free to edit it and write some more :)

Quote:
 

The Vigenčre cipher is a method of encryption that uses a series of different Caesar ciphers based on the letters of a keyword. It is a simplified version of the more general polyalphabetic substitution cipher, invented by Alberti circa 1465.
The invention of the Vigenčre cipher was misattributed to Blaise de Vigenčre in the 19th century; it was originally described by a Giovan Batista Belaso in his 1553 book La cifra del. Sig. Giovan Batista Belaso.

Source: Wikipedia

As said in the quote above, the Vigenčre cipher consists of numerous Caesar ciphers. In a Caesar cipher (shift cipher) the alphabet is shifted by a fixed number. For an example, the plain text ‘gamma’ is shifted by 3:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
DEFGHIJKLMNOPQRSTUVWXYZABC

GAMMA
JDPPD

The Vigenčre cipher uses shifts too, but the main differences are that the fixed number is a letter and that multiple letters are used. Lets start with the first one.

Lets say we want to use letter K for the shift:

ABCDEFGHIJKLMNOPQRSTUVWXYZ turns into
KLMNOPQRSTUVWXYZABCDEFGHIJ

That wasn’t that hard, was it? Now onto the multiple shifts. The fixed numbers (password) shall now be referred to as the key. The key for the next example will be hello.

Code:
 

ABCDEFGHIJKLMNOPQRSTUVWXYZ
H: HIJKLMNOPQRSTUVWXYZABCDEFG
E: EFGHIJKLMNOPQRSTUVWXYZABCD
L: LMNOPQRSTUVWXYZABCDEFGHIJK
L: LMNOPQRSTUVWXYZABCDEFGHIJK
O: OPQRSTUVWXYZABCDEFGHIJKLMN


Now, you can find the right ciphered letter by looking at the offset of your plaintext letter. If this is at position 1, the letter will be replaced by the one with the same alphabetical offset in alphabet H. The letter at position 2 is encrypted with E, etc. So the plain text ‘ape’ with key ‘hello’ would become HTP. If the length of the plain text exceeds the length of the key, the key is repeated. For example:

Code:
 
Plaintext:  ATTACKATDAWN
Key:  LEMONLEMONLE ( original key: LEMON)
Cipher text: LXFOPVEFRNHR
RRRREJMEEEEEPVKLWENFNVJKEEEEEAOLKAFKLXCFZAASDJXZTTTTTTTLSIOWJXMOKLAFJNNKFNXN
RAGRBAQEMHIGDJVDSEOXVIYCELFHWLELJFIENXLRATALSJFSLCYTKLASJDKMHGOVOKAJDNMNUITN
RRRRLJVEEEEECLYVYHNVPFTAEEEEEMWLMEIRNGLARWJAKJDFLWNTIERJMIPQWOTZEOCXKNUBNXCN
RJIRPOWEANFUSNCZVDVZNMSFEKLOEPZLDKDJWSAAAAAAAOERHJCTNCKFRIMVKSOFOMKMANREWNBN
RZUDRGXEEEEENFQIDVLQNCKNEEEEEDGLLLLLLAWIOSNCDARLODMTOEJXMILDFJROTKJSDNLVCZNN
Offline Profile Quote Post Goto Top
 
insecure
Elite member
[ *  *  *  *  * ]
Just a hint: When columns matter, as with Vigenere for example, use a non-proportional font (e.g. by using code tags).
Offline Profile Quote Post Goto Top
 
Revelation
Member Avatar
Administrator
[ *  *  *  *  * ]
Well, I used tabs, but they don't seem to work :sadangry:
RRRREJMEEEEEPVKLWENFNVJKEEEEEAOLKAFKLXCFZAASDJXZTTTTTTTLSIOWJXMOKLAFJNNKFNXN
RAGRBAQEMHIGDJVDSEOXVIYCELFHWLELJFIENXLRATALSJFSLCYTKLASJDKMHGOVOKAJDNMNUITN
RRRRLJVEEEEECLYVYHNVPFTAEEEEEMWLMEIRNGLARWJAKJDFLWNTIERJMIPQWOTZEOCXKNUBNXCN
RJIRPOWEANFUSNCZVDVZNMSFEKLOEPZLDKDJWSAAAAAAAOERHJCTNCKFRIMVKSOFOMKMANREWNBN
RZUDRGXEEEEENFQIDVLQNCKNEEEEEDGLLLLLLAWIOSNCDARLODMTOEJXMILDFJROTKJSDNLVCZNN
Offline Profile Quote Post Goto Top
 
PulsarSL
Super member
[ *  *  *  * ]
Revelation
Oct 6 2005, 06:39 PM
Well, I used tabs, but they don't seem to work  :sadangry:

Yea, tab takes you to the next form.

Pulsar
Offline Profile Quote Post Goto Top
 
Donald
Elite member
[ *  *  *  *  * ]
"Revelation"
 
Well, I used tabs, but they don't seem to work

Instead of tabs, manually space to make things line up. Like this:

Code:
 

   ABCDEFGHIJKLMNOPQRSTUVWXYZ
H: HIJKLMNOPQRSTUVWXYZABCDEFG
E: EFGHIJKLMNOPQRSTUVWXYZABCD
L: LMNOPQRSTUVWXYZABCDEFGHIJK
L: LMNOPQRSTUVWXYZABCDEFGHIJK
O: OPQRSTUVWXYZABCDEFGHIJKLMN


WARNING! for some reason the CODE tag sometimes strips one space off of lines that begin with a space. I haven't figured out why. Just be certain to do a preview before you post. The above text required FOUR spaces before the ABC line in order to get it to line up right.

Oh, don't look now, but your Vigenere tutorial is turning into a BBCODE tutorial! :)
Well, while we are off-topic. Any of you using firefox should get the BBCODE extension. It's a wonderful little tool for regular board users.

Donald
Offline Profile Quote Post Goto Top
 
cows
Unregistered

o.K. am i understanding this?

If i wanted to type my name would the finished code be:
Code:
 
 
CDEFGHIJKLMNOPQRSTUVWXYZAB
OPQRSTUVWXYZABCDEFGHIJKLMN
WXYZABCDEFGHIJKLMNOPQRSTUV
STUVWXYZABCDEFGHIJKLMNOPQR


Or am i getting this wrong?

--Edit--

Don't worry i misread the first post.

The code would be
Code:
 
ECSK


No need to panic - sorted it now
Quote Post Goto Top
 
insecure
Elite member
[ *  *  *  *  * ]
Donald was talking about cracking a Vigenere, not using one.

To use a Vigenere is easy enough. Pick a codeword. Example: NOTASTRONGKEY

Remove all duplicate letters: NOTASRGKEY

Using a Vigenere square... oh.

To construct a Vigenere square, take a square 27 cells by 27 cells in size.

Top row, starting at column 2, write the alphabet.

Left column, starting at row 2, write the alphabet.

Rows 2-27: starting in column 2, continue the alphabet started in column 1, re-starting from A when necessary.

Top bit of table looks like this:

Code:
 

+ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZAB
CDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCD


and so on.

Locate your plaintext letter on the top row.
Locate your key letter on the leftmost column.
Where that row and column cross, is your ciphertext letter.
Move on to next plaintext letter and next key letter (starting at the beginning of the key if you reach the end), and go round again until you run out of plaintext.




Offline Profile Quote Post Goto Top
 
rot13
Elite member
[ *  *  *  *  * ]
cows
Oct 11 2005, 03:21 PM
o.K. am i understanding this?

If i wanted to type my name would the finished code be:
Code:
 
 
CDEFGHIJKLMNOPQRSTUVWXYZAB
OPQRSTUVWXYZABCDEFGHIJKLMN
WXYZABCDEFGHIJKLMNOPQRSTUV
STUVWXYZABCDEFGHIJKLMNOPQR


Or am i getting this wrong?

If you wanted your name to be the keyword, you pretty much have it:

Code:
 

 ABCDEFGHIJKLMNOPQRSTUVWXYZ
 ----------------------------------------
 CDEFGHIJKLMNOPQRSTUVWXYZAB
 OPQRSTUVWXYZABCDEFGHIJKLMN
 WXYZABCDEFGHIJKLMNOPQRSTUV
 STUVWXYZABCDEFGHIJKLMNOPQR


Then to encrypt a message like "til the cows come home" you encrypt the first letter using the C line, the next letter using the O line, and so on. Here is the message with the line used to encrypt it written below:
Code:
 

TIL THE COWS COME HOME
COW SCO WSCO WSCO WSCO

so for line C, T is encrypted as V
for line O, I is encrypted as W
for line W, L is encrypted as H
for line S, T is encryptes as L,
for line C, H is encrypted as J
for line O, E is encrypted as S
...and so forth

The final encrypted message, with word breaks preserved, would be:
VWH LJS YGYG YGOS DGOS

Notice the repeating YGYG YG. That's an interesting thing. With Vigenere, encrypting C with a key of W is the same as encrypting W with a key of C. The word COWS is encrypted with a key of WSCO. So CO with a key of WS encrypts as YG. Likewise, WS with a key of CO also encrypts as YG.
Offline Profile Quote Post Goto Top
 
sas01
Just registered
[ * ]
I'm slightly confused :s if I wanted to write my name it would be

Code:
 

SHONONREKNGREPEONGRE
AHTRNHOPROPGNRTNHHPR
SGOTHPTRHOT?HOPT?HOR
04040346352543LOGOP34?
1432546454H6H65H7II67I


Ok that's all easy what I don't understand is this
Quote:
 

Then to encrypt a message like "til the cows come home" you encrypt the first letter using the C line, the next letter using the O line, and so on. Here is the message with the line used to encrypt it written below:
CODE

TIL THE COWS COME HOME
COW SCO WSCO WSCO WSCO

so for line C, T is encrypted as V
for line O, I is encrypted as W
for line W, L is encrypted as H
for line S, T is encryptes as L,
for line C, H is encrypted as J
for line O, E is encrypted as S
...and so forth

The final encrypted message, with word breaks preserved, would be:
VWH LJS YGYG YGOS DGOS

Notice the repeating YGYG YG. That's an interesting thing. With Vigenere, encrypting C with a key of W is the same as encrypting W with a key of C. The word COWS is encrypted with a key of WSCO. So CO with a key of WS encrypts as YG. Likewise, WS with a key of CO also encrypts as YG.


Can anyone explain to me please?
Offline Profile Quote Post Goto Top
 
rot13
Elite member
[ *  *  *  *  * ]
sas01
Dec 31 2005, 05:46 PM
I'm slightly confused :s if I wanted to write my name it would be

Code:
 

SHONONREKNGREPEONGRE
AHTRNHOPROPGNRTNHHPR
SGOTHPTRHOT?HOPT?HOR
04040346352543LOGOP34?
1432546454H6H65H7II67I


Ok that's all easy what I don't understand is this
Quote:
 

Then to encrypt a message like "til the cows come home" you encrypt the first letter using the C line, the next letter using the O line, and so on. Here is the message with the line used to encrypt it written below:
CODE

TIL THE COWS COME HOME
COW SCO WSCO WSCO WSCO

so for line C, T is encrypted as V
for line O, I is encrypted as W
for line W, L is encrypted as H
for line S, T is encryptes as L,
for line C, H is encrypted as J
for line O, E is encrypted as S
...and so forth

The final encrypted message, with word breaks preserved, would be:
VWH LJS YGYG YGOS DGOS

Notice the repeating YGYG YG. That's an interesting thing. With Vigenere, encrypting C with a key of W is the same as encrypting W with a key of C. The word COWS is encrypted with a key of WSCO. So CO with a key of WS encrypts as YG. Likewise, WS with a key of CO also encrypts as YG.


Can anyone explain to me please?

Okay, first of all, a typical Vigenere cipher only uses letters, so the 01 at the end of your name wouldn't count. Second, Vigenere is done by shifting a regular A-Z alphabet by different positions. To make a key from your name, at least the SAS part, you create three alphabets, the first and last starting with S, wrapping around and finally ending at R. The middle alphabet, since it starts with A would be a regular A-Z alphabet:

Code:
 

STUVWXYZABCDEFGHIJKLMNOPQR
ABCDEFGHIJKLMNOPQRSTUVWXYZ
STUVWXYZABCDEFGHIJKLMNOPQR


Notice that your name appears if you look at the first letter in each row.

You have three alphabets to work with. You encode the 1st letter with the first alphabet, the second letter with the second alphabet, the third letter with the third alphabet ,and then the fourth letter goes back to the first alphabet.

To encode a letter with the first alphabet, you can write it like this:
Code:
 

PLAIN:  ABCDEFGHIJKLMNOPQRSTUVWXYZ
CIPHER: STUVWXYZABCDEFGHIJKLMNOPQR

So to encrypt a letter, you look on the Plain line to find the letter. The encrypted letter is the one below it. For example, C is encrypted as U, F is encrypted as X, and so on. Now, on your middle alphabet, since it starts with A, the letters aren't really encrypted since A encrypts as A, B as B and so on.

Going back to the previous example, the sentence to be encrypted was "TIL THE COWS COME HOME"
I wrote "COW SCO WSCO WSCO WSCO" underneath it to indicate which alphabet to use. The alphabet beginning with C works like this:

Code:
 

Plain:  ABCDEFGHIJKLMNOPQRSTUVWXYZ
Cipher: CDEFGHIJKLMNOPQRSTUVWXYZAB

I said that T is encrypted as V. To get that, I looked at the Plain line, found T, then looked for the letter beneath it, which was V.

For the O alphabet, you have:
Code:
 

Plain:  ABCDEFGHIJKLMNOPQRSTUVWXYZ
Cipher: OPQRSTUVWXYZABCDEFGHIJKLMN

I want to encrypt I, and I see that W appears under it, so I is encrypted as W.

I hope that makes sense.
Offline Profile Quote Post Goto Top
 
sas01
Just registered
[ * ]
That makes perfect sense! Thankyou! I can't believe I couldn't figure that out last night lol.
Regards sas01
Offline Profile Quote Post Goto Top
 
PulsarSL
Super member
[ *  *  *  * ]
What we need now is a definitive guide to cracking a vigenere using IOC attacks.

Pulsar
Offline Profile Quote Post Goto Top
 
Revelation
Member Avatar
Administrator
[ *  *  *  *  * ]
Well, most of us know how to do that. You can search the forum for an IOC calculator. When you have downloaded it, let ik check the text and the shift with the highest number (around 6.5) is the keylength.
RRRREJMEEEEEPVKLWENFNVJKEEEEEAOLKAFKLXCFZAASDJXZTTTTTTTLSIOWJXMOKLAFJNNKFNXN
RAGRBAQEMHIGDJVDSEOXVIYCELFHWLELJFIENXLRATALSJFSLCYTKLASJDKMHGOVOKAJDNMNUITN
RRRRLJVEEEEECLYVYHNVPFTAEEEEEMWLMEIRNGLARWJAKJDFLWNTIERJMIPQWOTZEOCXKNUBNXCN
RJIRPOWEANFUSNCZVDVZNMSFEKLOEPZLDKDJWSAAAAAAAOERHJCTNCKFRIMVKSOFOMKMANREWNBN
RZUDRGXEEEEENFQIDVLQNCKNEEEEEDGLLLLLLAWIOSNCDARLODMTOEJXMILDFJROTKJSDNLVCZNN
Offline Profile Quote Post Goto Top
 
rot13
Elite member
[ *  *  *  *  * ]
PulsarSL
May 25 2006, 01:27 AM
What we need now is a definitive guide to cracking a vigenere using IOC attacks.

Pulsar

Do keep in mind that IOC is useful for determining the key length, but after that, you have to use something else to actually recover the key. In general, you can shift through possible key values and compare the decoded results with the standard frequencies for English. For a Vigenere text of a resonable size, this technique works quite well. For shorter texts it can be a little more difficult and you may have to resort to trial and error, or crib dragging.

I have found myself using IOC several times lately and I almost wonder if we need a tutorial in how to use IOC to attack various ciphers. Maybe it will due to just mention what it is good for and what it isn't. IOC tests whether the repetitiveness of a group of items is similar to a known group. The most common example is, do these letters repeat in roughly the same amounts that English does?

If letters are about evenly distributed, the IOC is usually in the 0.03 to 0.04 range. For English text it is in the 0.06 to 0.07 range. If there are only a few letters you could see much higher values. The IOC for the raw ADFGVX ciphertext in Loki's challenge is just under 0.2.

To compute the IOC (technically, what I am presenting here isn't IOC but the PHI test, but it works out the same), sum f*(f-1) where f is the number of occurrences of each letter. If you have 5 A's, 3 B'2 and 1 C, you add 5*4 + 3*2 + 1*0. You divide this sum by N*(N-1) where N is the total number of letters. Again, with 5 A's, 3 B's and 1 C, that's 9 * 8. So the IOC is 26/72 or about 0.36.

To apply IOC to a Vigenere or other periodic cipher, you are basically trying various key lengths and seeing if the IOC of the resulting alphabets is close to English (or whatever language you think the plaintext is in). For a key length of 3, for example, you take letters 1, 4, 7, 10, 13, etc. and compute the IOC. Then you take letters 2,5,8,11,14,etc. and compute the IOC, then take letters 3,6,9,12,15,etc. and compute the IOC. Then you average those 3 IOCs. Next, you do the same procedure for the 4 alphabets generated for a key length of 4, and so forth. The highest IOC probably indicates the right key length, although sometimes multiples of the actual key length may score higher.

IOC can also be used for fractionating systems like ADFGVX and straddling checkerboards. For ciphers like these, you are not looking for a key length, but for an equivalent monoalphabetic substitution (i.e. instead of just solving the cipher outright, you convert it into a monoalphabetic substition and THEN solve it). With ADFGVX, a plaintext letter is represented by a pair of letters, and these pairs are broken up and scrambled. If you think you have unscrambled these pairs back into the original representation, you can use IOC to see whether your unscrambling produces text with the same repetition characteristics as English. Likewise, with straddling checkerboard where a letter can be represented by either a single digit or by a 2-digit number, you can try various possibilities for the 2 first digits of the 2-digit numbers, and check the resulting text to see if it has the same repetition characteristics as English. I found with the checkerboard that I often had alphabets with more repetition, so the IOC was higher. Instead of picking the highest, I picked what was closest to 0.066.

IOC is typically useless for a monoalphabetic substitution because the IOC of the substituted text is the same as the original. Where in the original you might have 14 E's, the substitution man have 14 Q's, and when that's converted into a number, it makes no difference what the original letter was.

IOC on single letters is also pretty useless for a transposition, because the letter frequency should already be about the same as English. For some transpositions, however, it may be useful to compute a digraphic IOC. That is, instead of doing the IOC on the frequency of single letters, you can do it on every pair of letters. It is the same procedure, sum f*(f-1) for all digraphic frequencies (how many AA's, AB's, .. ZZ's) and divide by N*(N-1) the total number of digraphs, which should be the number of letters / 2. For English, that number should be around 0.0069 as opposed to 0.0015 for random text (I get these numbers from Lanaki's Lesson 2 which has a great discussion on IOC.

You can also use IOC to help identify ciphers. An issue of The Cryptogram last year had a table with a number of expected test values for various ciphers that included the expected monographic and digraphic IOC's.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · News · Next Topic »
Add Reply