#!/usr/bin/perl # Converts 'rootrootrootrootrootroot' into 'just another perl hacker' # Data contains 48 bytes: first 24-bytes => (0=skip, 1=convert to space) # and last 24-bytes are ascii offsets for character conversions, and is # iterated twice through. my @data = qw( 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 8 -6 -4 0 0 14 1 5 -2 7 10 2 0 -1 10 2 6 0 7 19 15 4 10 2 ); my $p_turn_root_into_japh = sub{ my $arg = shift; for (my $i = 0; $i < @data; $i++) { my $c = $data[$i]; my $pclosure = sub { my $p = $_[0]; # Uncomment next line to see string conversion progression # printf "[$arg]\n"; if ($i > 23) { # Now convert 1 char at a time from 'rootrootroot...' # to the target char, by subtracting appropriate ascii val. # Comment out next line only, and you get: # "root ootroot ootr otroot" substr($$p, $i-24, 1) = chr(ord(substr($$p,$i-24,1))-$c); } if ($c && $i < 24) { # Comment out next line only, and the end result is: # "justranotherrperlohacker" substr($$p,$i,1) = ' '; } }; $pclosure->(\$arg); } return $arg; }; printf "%s\n", $p_turn_root_into_japh->('rootrootrootrootrootroot'); #### print&{sub{$z=$_[0];for((0)x24,qw#8 -6 -4 0 0 14 1 5 -2 7 10 2 0 -1 10 2 6 0 7 19 15 4 10 2#){$::=sub{substr(${$_[0]},($l>23)?$l-24:$l,1)=chr(($l<24&&0x21010& 1<<$l)?32:ord(substr ${$_[0]},$l-24,1)-$_)};&$::(\$z);$l++};$z}}(q#root#x6).$/