This is not all my own work, I re-used an existing obfu and added a new twist
Thanks to arhuman for the base code that I used
Update:Fixed, thanks dragonchild
#!/usr/bin/perl $|=3;$N=1415;$M=int(3.3*$N);$t[0]=2;$s[ 0]=2;@j=(49,44,75,76,69,48,24,8,207,18, 64,46,57,6,2,3,19,38,04,64,36,78);$a=0; sub z{$a=$r=00};for($k=1;$k<$M;$k++){$a =$r=0;};for($k=01;$k<$M;$k++){&z;for($i =$N;$i>=0;$i--){$a=$t[$i]*($k)+$r;$t[$i ]=int($a%10);${r}=int($a/10);};$K=($k<< 1)+1;&{z};map{$a=$t[$_]+(10)*(($r));${t }[$_]=int($a/($K));${r}=int(($a)%($K))} (0..$N);if(($r>=(int(($K)/2)))){${t}[$N ]++}while($t[$N]>9){ ${t}[$N]-=10;$t[$N -1] ++;};&z();for($i=$N;$i>=0;$i--){$a= ($t[$i]+$s[$i]+$r);${s}[$i]=int($a%10); $r=int($a/10);};if($k>$x+3){;${x}=$k;$c =$s[$y]if($y==$j[0]);if($y==$j[0]+1){ print chr($c*10+$s[$y]+64);$j[1]+= shift@j;}$y++;}}

Replies are listed 'Best First'.
Re: Slow JAPH
by dragonchild (Archbishop) on Sep 22, 2003 at 18:48 UTC
    After cut'n'paste ...
    perl abcd syntax error at abcd line 7, near "=" syntax error at abcd line 7, near "--)" syntax error at abcd line 8, near ");" Execution of abcd aborted due to compilation errors.

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Finding messages in pi
by PhilHibbs (Hermit) on Sep 23, 2003 at 10:55 UTC
    Here is the code that I used to find my message in pi:
    $pi = "314159265358979323..."; $base = -65; $offset = 0; while ($offset < (100 - (ord('_')-65))) { print "Offset $offset "; $find = "JUST_ANOTHER_PI_HACKER"; $index = 0; while ($find ne "") { $fnum = sprintf("%2.2d",ord(substr($find,0,1))+$base+$offset); substr($find,0,1) = ""; $found = index($pi, $fnum, $index+2); print "FAILED" if $found < 0; $found -= $index; $index += $found; print "$found "; } print "\n"; ++$offset; }
    You will have to find yourself a suitable source of pi digits, I recommend either the algorithm that I borrowed, or Project Gutenberg (zip). Figure on 100 digits per letter, then sum the offsets produced to find out how many digits are actually used.

    I chose to limit it to upper case letters and underscores as spaces, but that can be fixed. It scans a range of offsets so you can choose the shortest list of positions, then calculate the offset to recreate the original message. In the instance provided, it just happens that an offset of 1 results in +64 in the recreation code, which is actually rather disappointing because it looks like I didn't make the effort to optimise the offset list! If I had done "JUST_ANOTHER_PERL_HACKER" that would have resulted in offset 29, giving +36 instead of +64 in the final code, and I could have asked "For bonus ++, why is the +36 value there?"