#!/usr/bin/perl
## z340crack written by Bowie J. Poag
##
## This script attempts to brute-force crack Quadrant 3 of the Zodiac
+killer's "Z340" cipher.
##
$|=1;
## 1 = Backward B
## 2 = Left half filled circle
## 3 = Filled P
## 4 = Filled circle
## 5 = Backward C
## 6 = Circle with vertical line
## 7 = Butt, left dimple
## 8 = Filled triangle
## 9 = Backward P
## = = Upside-down T
## # = Backward F
## % = Backward Q
## & = Top half filled circle
## : = Backward L
## ; = Circle with horizontal line
## ' = / Forward slash
## { = Square
## } = Southwest filled square
## _ = Caret
## X = Plus sign
## ] = Dot
##
##
## Ciphertext block: YB91TMKO
## T2M]X3BF
## 4FB5678R
## 1]5V2=XX
## E>VUZ4-X
## 9_]#M%G&
## XF:WBI;L
## OSHT'6;9
## {YOB}-C5
## ZO8AIK7X
##
##
##
## One liner: YB91TMKOT2M]X3BF4FB5678R1]5V2=XXE>VUZ4-X9_]#M%G&XF:WBI;
+LOSHT'6;9{YOB}-C5ZO8AIK7X
##
$z=0;
while ($z>=0)
{
$#table=-1;
$normalAlphabet="abcdefghijklmnopqrstuvwxyz";
$zodiacAlphabet="=>_-;:']{}&#%123456789ABCEFGHIKLMORSTUVWXYZ";
$cipherText="YB91TMKOT2M]X3BF4FB5678R1]5V2=XXE>VUZ4-X9_]#M%G&X
+F:WBI;LOSHT'6;9{YOB}-C5ZO8AIK7X";
$oldZ=$zodiacAlphabet;
$x=0;
while($x<100) ### Scramble the alphabet so that symbol select
+ion is random. 100 iterations should do.
{
$offset=int(rand(length($zodiacAlphabet))); ## Pick a
+symbol somewhere in the string..
$offset--;
$splitter=substr($zodiacAlphabet,$offset,1);
$zodiacAlphabet=~/$splitter/;
$zodiacAlphabet=$'."$splitter".$`; # Swap the right ha
+lf and the left half of the match..
$x++;
}
$x=0;
while ($x<length($zodiacAlphabet))
{
$l=length($zodiacAlphabet);
$thisSymbol=substr($zodiacAlphabet,$x,1);
$letter=int(rand(length($normalAlphabet)));
$table[$letter].="$thisSymbol";
$x++;
}
## The table has now been built. All letters in the normal alp
+habet now have a random number of zodiac symbols assigned to them.
$x=0;
$x=0;
$y=0;
while ($x<length($normalAlphabet)) ## For every letter of the
+normal alphabet, replace the symbols assigned to it in the cipher.
{
$thisLetter=substr($normalAlphabet,$x,1);
$y=0;
while($y<length($table[$x]))
{
$thisSymbol=substr($table[$x],$y,1);
$cipherText=~s/$thisSymbol/$thisLetter/g;
$y++;
}
$x++;
}
$z++;
## Look for pay dirt..
## The misspellings here are intentional, taken from known exm
+aples
## of the Zodiac killer's previous writings. A match on any of
+ these
## words would be a hint of a significantly stronger "signal"
+among
## the noise.
@signalWords=("children","others","around","shall","about","pe
+ople","would","missed","police","because","thing","there","could","ra
+ther","light","school","vallejo","useing","triger","howers","cerous",
+"meannie","killed","victom","speaking","lyeing","slaves","afterlife",
+"zodiac","intersting","idenity","woeman","untill");
foreach $signal (@signalWords)
{
if ($cipherText=~/$signal/)
{
$signalValue++;
$signalsFound.=" $signal";
}
}
if ($z%9==0)
{
print "Processing: Pass #$z [$cipherText]\r";
}
if ($signalValue>=3)
{
print "\n\n\nMATCH FOUND: $cipherText (Count: $signalV
+alue, $signalsFound ), cycle $z\n\n";
open (FILE,">>/tmp/zodiac.txt");
print FILE "\n\n\nMATCH FOUND: $cipherText (Count: $si
+gnalValue, $signalsFound ), pass $z\n\n";
$x=0;
while ($x<length($normalAlphabet))
{
$thisLetter=substr($normalAlphabet,$x,1);
print "\t$thisLetter equals ($table[$x])";
print FILE "\t$thisLetter equals ($table[$x])"
+;
if ($x%4==0 && $x>0)
{
print "\n";
print FILE "\n";
}
$x++;
}
close (FILE);
print "\n\n";
}
$signalValue=0;
$signalsFound="";
$signal="";
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.