Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Vigenére cipher

by teamster_jr (Curate)
on May 15, 2006 at 13:48 UTC ( #549500=note: print w/replies, xml ) Need Help??

in reply to Vigenére cipher

Thoroughly enjoying this series of obfu's ++chargrill.

i mentioned this to you in /msg but thought other might be interested.
I went to a really interesting lecture at the royal society by simon singh, author of the code book, about almost exactly what you're doing - going through different cyphers through history.
He set a challenge for teams to crack 10 increasingly difficult cyphers.
stage 4 was Vigenčre
running up to DES and RSA.
very interesting.

Replies are listed 'Best First'.
Re^2: Vigenére cipher
by chargrill (Parson) on May 15, 2006 at 20:34 UTC

    I just bought that book a few weeks ago (after I got my algorithm down for the vigenere cipher, but before I fully obfuscated it) because my other source of information/inspiration for additional algorithms was running dry, and I was trying to figure out a few things:

    1. Next stops for my tour through old encryption ciphers
    2. How to 'break' the 'undecipherable cipher'. I had an idea or two from reading the entry on wikipedia, but was left wanting a more in depth discussion of letter frequency analysis.

    I'm glad you posted the link to the book, I was able to get my hands on an electronic version of the ciphertext from the book (I wasn't about to type it all in by hand!) and run my cracking script against it - I was pretty happy to find that I was able to decipher the keyword used to encode that ciphertext, though I wouldn't've recognized the plaintext because it's in french :)

    I'm now trying to figure out how to easily get from having the encoding key and the ciphertext and working backwards to get the original plaintext - it's unfortunately not as much of a slam dunk as I thought it would be - but I guess I now know what I'll be working on tonight.

    Update: I've finished the breaking script, but it's turned into a monster (what the the optional html formatted output). I was intending to either obfuscate it and post it separately, or post it as a followup to the original node, but I'm thinking instead of posting it to the code section, now that I've started a long way towards cleaning it up, passing strict and warnings, and even documented it with some POD. Comments welcome. End update

    I also read up on how the "official" solution for that particular ciphertext was arrived upon, and I am a little embarassed to say that my method for extracting a likely encoding key isn't quite as sophisticated as theirs. I just search for repeating strings, find the greatest common denominator factor for the intervals between the repeats, build a little data structure and "compare" it to a standard letter distribution frequency for plaintext of a similar size. Or something like that.

    $,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse s +plit//=>$* ){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$# +C]=$/;($#C >$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^ +$$C[$%++]}

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://549500]
[1nickt]: Yaerox probably best to whip up an SSCCE demonstrating the failure in what you have now and post to SoPW as a question.
[Corion]: Yaerox: That's a somewhat hard problem. Encode solves the conversion part, but for guessing what encoding a file is in, that's the hard part
[Corion]: Yaerox: There is Encode::Guess, but that needs a limited set of inputs, and it also cannot handle multiple single-byte encodings
[Corion]: If you have a BOM, that's a really easy way to recognize UTF-8. Otherwise, you can try to decode a file from UTF-8, and if that works OK and doesn't crash, most likely the file was valid UTF-8
[Corion]: But as "ansi" (Latin-1?) is a single-byte encoding, any file is a valid ANSI file

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2017-03-28 13:13 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (331 votes). Check out past polls.