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.