JAPHs and other fun with obfuscation

I like recreational obfuscation. Not that I'm really good at it, but here's some examples of what I wrote during inspiration attacks.

Fermat numbers

#!/usr/bin/env perl
s3:n(q{Just });s5:n("another ");s17:n(q{Perl });s257:n("hacker");
s65537:n("\n");$p=1;sub n{$p++; $w=2**(2**$p)+1;print@_;goto"s$w"
unless grep/^1$/,map{1 if $w%$_==0}(2..int(sqrt($w)));exit;};n;1;

Should print “Just another Perl hacker”. Labels contain Fermat numbers, n() subroutine jumps to them as long as the next number is prime.

Email is the key

#!/usr/bin/env perl
@a=split(//, "daniil @ baturin  . org" ); # Daniil Baturin

Should print traditional “Just another Perl hacker”.

The idea was to make the email address not easily removable or replaceable to use it as a signature block.

So the email address was used as a key for running key variant of Viginere cipher modified to work on the whole range of printable ASCII characters instead of its traditional letter only form.

Three primes

#!/usr/bin/env perl
use bigint;$i=
8311 * 11506699 * 5456897772732206286791603681159406921396401

Should print traditional “Just another Perl hacker”.

Simply obtains character codes from the string converted to number and then factorized.

Seven points of Python

from math import log, exp
print ("".join(map(lambda

Should print “Python”. Last I checked, it works with either Python 2.7 or Python 3.

The function that produces the ASCII codes of the “Python\n” string was constructed with Lagrange polynomial interpolation.

Perl is in my heart (or vice versa)

#!/usr/bin/env perl
use bigint;$h=0x3eff8fe0f0047c5fd;
while($h){$_.=$h&1?' ':'*';$h/=2};

Should print an ASCII heart:

 *       * 
***     ***

Obviously, written for Feb 14th. Specifically, for a valentines day contest my ISP once held where users submitted their postcards, videos, and the like. To their credit, they ran it in some test VM and posted a screenshot of the terminal.

Spaces are encoded with zeroes and stars with 1's, packed into single hexadecimal number.


#!/usr/bin/env perl
@glider= ([  0, 1, 0  ],
          [  0, 0, 1  ],
          [  1, 1, 1  ]);

@hacker= ([ 3.00, 3.00, 2.45 ],
          [ 4.00, 2.90, 2.85 ],
          [ 4.00, 2.90, 2.88 ],
          [ 3.90, 3.80, 2.95 ],
          [ 3.90, 3.60, 2.85 ],
          [ 4.00, 3.95, 3.04 ],
          [ 1.00, 1.00, 0.95 ]);

sub mul(\@\@){@r=();for($i=0;$i<3;$i++){for($j=0;$j<3;$j++){;$r
[$i]+=$_[0][$i][$j]*$_[1][$i]}}return\@r}sub ip(\@){$w=0;for($k
=0;$k<3;$k++){$w+=$_[0][$k]*$_[0][$k];}return chr(int($w));}for

I generally support Eric Raymond's idea to use the glider as technology neutral hacker subculture emblem.

Here the glider is represented as a 3x3 matrix and the ASCII codes or the “Hacker” word characters are calculated as (squares of) euclidian norms of constructed vectors after applying the glider operator matrix to them.

Christmas tree


Early attempt, made for 2010 winter holidays.

This page was last modified: 2015 June 08