I'm sure quite a few of you guys have read/heard of Simon Singh's book The Code Book (if not it's well worth checking out).
Well here is my script that I used to crack the second puzzle in the book. It's nothing very elaborate but just in case anyone might be interested.
The code is
and it's a Caesar Shift codeMHILY LZA ZBHL XBPZXBL MVYABUHL HWWPBZ JSHBKPBZ JHLJBZ KPJABT HYJHUBT LZA ULBAYVU
I also have a script for the first puzzle also if anyone is interested.use strict; open(CODE,"code2.txt"); my @code=<CODE>; close(CODE); my @alphabet = ("A".."Z"); my (%crypt); foreach my $try_number (0 .. 26){ print STDOUT "\n---- Shift of $try_number :\n"; foreach my $letter (A .. Z){ my $index= ($try_number++)%26; $crypt{$letter} = $alphabet[$index]; } foreach my $code_line (@code){ foreach my $letter_or_space (split(//,$code_line)){ if ($letter_or_space =~/\s+/){ #Got a space print STDOUT " "; }else{ print STDOUT $crypt{$letter_or_space}; } } } } print STDOUT "\n";
PS The script produces all the options you have to spot the correct solution. It should be pretty obvious :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Caesar Shift Solution
by japhy (Canon) on May 14, 2001 at 18:07 UTC | |
|
Re: Caesar Shift Solution
by tachyon (Chancellor) on May 17, 2001 at 08:45 UTC |