If you are unfamiliar with
Kryptos, it is a sculpture by James Sanborn located on the campus of the CIA headquarters, located in Langley, VA. (Usually off limits to the general public) The sculpture, made in the shape of a scroll, holds a series of four encrypted messages. Although the code was intended by Sanborn to be decrypted by hand, only three of the four passages have been deciphered, and those only through machine aided cryptoanalysis. Credit for breaking the first three keys belongs to Jim Gillogly.
The code below does not embody any "cracking" functionality, it contains decryption algorithms that require the keys to function.
The first two messages are encoded by character replacement algorithms called a Vigenere cipher. The third is encrypted by keyed columnar transposition and route transposition. The encryption method(s) used on the fourth passage have yet to be determined.
$nl=qr;\r*\n\r*;;sub __($@){join$?[0],@?[1..$#_];}sub _($;$){split$?[0
+],$?[1]||$?;}
$m=qq|KRYPTOS${*?=*_;|x2;$m=~s[$nl];;;%dkeys=map{$?=>$m=~ m/($_.{26})/
+;}@tr=_$*,$m;
$/=$*;@parts=map{[_ $nl,$_] ;}_ '_', <DATA> ;$#="edrkpyt"; su
+b dekrypt{@c=
map{_$,}@{$_[0]};$n=@p=_$*, $_[1]; $=%=$=;return __ '', map {
+m"[A-Z]"? $tr
[index$dkeys{$p[$=++%$n ]}, $?]: $_;}@c;}$#=~s/(.)(.)/$2$1/g;
+sub ::{$l=@c=
reverse map {_ $,}@{$_[0]}; $k =@k=_ $*,$_[1];$g=$?[2];$__c=$
+g%$k;$d=($k-1
)-$__c;$_r=($l-($d*$__c)) / $k;$__r=$_r+$d;@cr=();$kc=__ '',
+ sort {$a cmp
$b}@k;@i=map{index$kc,$_; } @k ;@__c=(@i)[0..($__c-1)];for$x(
+0..($k -1) ){
if(grep{$_ == $x}@__c) {for (1.. $__r){$cr[$x].=shift@c;}}else
+{ for(1..$_r)
{$cr[$x].=shift@c;}}}@g =() ;$g_= int($l/$g)+($l%$g>0);foreac
+h$r(0..($k-1)
){for($x=0;$x<length($cr[$r ]);$x+= $g_){push@{$g[$r]},substr(
+ $cr[$r], $x,
$g_);}}$gc=int($__r/$g_)+ ( $__r%$g_> 0);@l=();foreach $c (0 .
+. ($g_- 1)) {
foreach $g__ (0 .. ($gc - 1) ){ foreach $r (@i) {@l [$c] .= substr $g[
+$r] [$g__],$c
,1;}}} $ct = __ '', @l ; $ct =~ s/^(.)(.*)/$2$1/; return $ct;} }ABCDEF
+GHIJLMNQUVWXZ
sub : {print ${#}->( $parts[0], uc "palimpsest"), "\n\n"; print ${#}-
+>( $parts [1]
, uc "abscissa" ) , "\n\n"; print :: ( $parts [2] , uc "kryptos", 86),
+ "\n\n" ; } ;
__DATA__
EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJ
YQTQUXQBQVYUVLLTREVJYQTMKYRDMFD_
VFPJUDEEHZWETZYVGWHKKQETGFQJNCE
GGWHKK?DQMCPFQZDQMMIAGPFXHQRLG
TIMVMZJANQLVKQEDAGDVFRPJUNGEUNA
QZGZLECGYUXUEENJTBJLBQCRTBJDFHRR
YIZETKZEMVDUFKSJHKFWHKUWQLSZFTI
HHDDDUVH?DWKBFUFPWNTDFIYCUQZERE
EVLDKFEZMOQQJLTTUGSYQPFEUNLAVIDX
FLGGTEZ?FKZBSFDQVGOGIPUFXHHDRKF
FHQNTGPUAECNUVPDJMQCLQUMUNEDFQ
ELZZVRRGKFFVOEEXBDMVPNFQXEZLGRE
DNQFMPNZGLFLPMRJQYALMGNUVPDXVKP
DQUMEBEDMHDAFMJGZNUPLGEWJLLAETG_
ENDYAHROHNLSRHEOCPTEOIBIDYSHNAIA
CHTNREYULDSLLSLLNOHSNOSMRWXMNE
TPRNGATIHNRARPESLNNELEBLPIIACAE
WMTWNDITEENRAHCTENEUDRETNHAEOE
TFOLSEDTIWENHAEIOYTEYQHEENCTAYCR
EIFTBRSPAMHNEWENATAMATEGYEERLB
TEEFOASFIOTUETUAEOTOARMAEERTNRTI
BSEDDNIAAHTTMSTEWPIEROAGRIEWFEB
AECTDDHILCEIHSITEGOEAOSDDRYDLORIT
RKLMLEHAGTDHARDPNEOHMGFMFEUHE
ECDMRIPFEIMEHNLSSTTRTVDOHW?_OBKR
UOXOGHULBSOLIFBBWFLRVQQPRNGKSSO
TWTQSJQSSEKZZWATJKLUDIAWINFBNYP
VTTMZFPKWGDKZXTJCDIGKUHUAUEKCAR
-- So prophesied the shakespearean monkeys, and so it shall be.
In reply to Kryptos
by Felonious
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.