Skip to main content

Decoding vigenère

I was reading Simon Singh book "The Code Book" when I stumbled accross Vigenère, I had time so I decided to code something to break Vigenère.
Here I'll present the method used to break Vigenère and release the code. The code is incomplete! I didn't code the decoding routine completeoy since I realize that decoding Vigenère is useless nowadays and I did the most interesting part : the kasisky algorithm.
The main interest of Vigenère code breaking is about elaborating the needed algorithms.

Vigenère code breaking go as follow :
- Find the key size using kasisky examination or index of coincidence
- Frequency analysis on each subtext : nbSubtext = szKey

I chose to use the kasisky examination for searching the key size.
I elaborated a recursive algorithm to build my dictionnary of ALL possible words of any size in the crypted text using a binary tree.

The algorithm steps are as follow :
begin
size = 1

begin loop_word_size
begin loop_word_add
dict_word_add (crypted, szWord)
crypted = crypted + 1
goto loop_word_add as long as we aren't at end of crypted
size = size + 1
goto loop_word_size as long as size != szCrypted

The pseudo code is iterative.
The recursive algorithm is in dict_word_add().

With a 512 bytes word, you have more than 130k possible words all uniques, no duplicates.
We track offsets, and counts of each words

After finding the key size, we do a frequency analysis of each subtext.
The only part missing to have a complete Vigenère code breaking is a reliable (and simple) algorithm to shift the frequencies to match. When that's done, you have the correspondance between the characters and can thus decode the ciphered text without the key.

In the sources I present, I sorted the frequencies in order to show them on screen. It isn't a step of the decoding.

There is a mitigation against Vigenère code breaking, use a key as long as the text, or the Vernam Code which is more commonly known as the one time pad code. The problem with one time pad code is the management and distribution of keys.


The code isn't clean at all but I release it for interested people as if I don't, it will be forgotten in my hard drive.

Hope you enjoy it.

m_101

- Source code : http://rapidshare.com/files/398364832/cryptanalysis.tar.gz.html
MD5: CF5BA403FB9D9106FDF51D5AEB33C526

Facebook

Facebook Recommendations

Followers


Web Designing In Karachi



Haroof.com


Politics blogs

My Zimbio

Email Subscribe

Enter your email address:

Watch online Live TV

Popular posts from this blog

Matric General Group Result SECONDARY SCHOOL CERTIFICATE (S. S. C.) PART - II CLASS - X - 2010 (www.apnieyesp.com )

PASSED THE SECONDARY SCHOOL CERTIFICATE (S. S. C.) PART - II CLASS - X) ANNUAL EXAMINATION, 2010. ERRORS AND OMISSIONS EXCEPTED, CANDIDATES BEARING THE FOLLOWING ROLL NUMBERS ARE DECLARED TO HAVE PASSED THE SECONDARY SCHOOL CERTIFICATE (S. S. C.) PART - II CLASS - X) ANNUAL EXAMINATION, 2010. ------------------------------------------------- GENERAL GROUP (REG&PVT) --- GRADE..'A-ONE' ---- ----------------------- ( CANDIDATES SECURING TOTAL MARKS 680 AND ABOVE) MARKS SECURED BY THE CANDIDATES OUT OF TOTAL MARKS OF 850 ARE MENTIONED AGAINST EACH ROLL NUMBER IN BRACKET --------------------------------------------------- 601086 (689) XXX (XXX) XXX (XXX) XXX (XXX) XXX (XXX) XXX (XXX) 601327 (681) 363 (684) 364 (719) 407 (685) 664 (682) 788 (687) 601836 (692) 882 (683) XXX (XXX) XXX (XXX) XXX (XXX) XXX (XXX) 602315 (723) 316 (715) 320 (712) 321 (739) 325 (686) 326 (702) 602327 (683) 329 (70...

In Depth: Could robots be the writers of the future?

CNETAnalysis: It might be concerned with aliens, outer space and dimensional jumping for now, but ‘sci-fi’ might have to be redefined if the latest advances in automated writing continue apace. Software that can construct sentences, analyse data and even put a ‘spin’ on a news story are threatening to make the newsdesk and the author’s writing room very different places. The end for journalists? Journalism isn’t complicated. The popularity of online news stories can be tracked – and therefore the importance of news easily ranked – while almost everything is written using the inverted pyramid structure . Since automated writing software can already do most of that, are we looking at the last generation of human journalists? Narrative Science’s Quill is the leading automated writing software title. It transforms structured data into readable, plain English stories that are identical to those written by humans, ...

Cnews Latest Stories:

SC dismisses last petition against Musharraf’s eligibility ISLAMABAD: Supreme Court Thursday dismissed the last petition against President Musharraf's eligibility to contest the presidential elections. The verdict came after a brief hearing of Dr. Zahoor Mehdi’s petition by the full bench of the apex court headed by Chief Justice Mr. Justice Abdul Hameed Doggar.On Monday, the court had dismissed five petitions against President Musharraf’s nomination, including the challenges from the presidential candidate Justice (Rtd) Wajihuddin and Makhdoom Amin Fahim.Attorney General had earlier said that President Musharraf would quit his army post and take oath as civilian president as early as Saturday if the presidential re-election was approved by the apex court. Lahore: People pouring in camp to show solidarity with Geo (Updated at 1410) LAHORE: People from different walks of life continuously visiting the solidarity camp outside Geo office in Lahore to express solidarity with Geo Tele...

Labels

Show more