As evolution of this old idea, here is new and less dumber alphabetical obfuscator. Any bug reports and ideas how to squeeze its results are welcome.
#! /usr/bin/perl -X
%code = (
"\t" => "chr oct ord w",
"\n" => "chr hex a",
' ' => "chr oct hex ffa",
'!' => "chr hex hex hex f",
'"' => "chr oct oct hex ceaa",
'#' => "chr oct hex abaa",
'$' => "chr oct hex afaa",
'%' => "chr oct oct hex daaa",
'&' => "chr hex oct hex cda",
"'" => "chr oct hex baba",
'(' => "chr hex oct hex daa",
')' => "chr oct hex caaa",
'*' => "chr oct hex ceaa",
'+' => "chr oct sqrt hex afa",
',' => "chr oct sqrt hex baa",
'-' => "chr oct hex daaa",
'.' => "chr oct hex ddea",
'/' => "chr oct sqrt hex cba",
0 => "oct a",
1 => "m mm",
2 => "int log hex a",
3 => "int sqrt hex a",
4 => "int log ord a",
5 => "int log hex aa",
6 => "chr sqrt hex baa",
7 => "int log hex aaa",
8 => "int oct ord l",
9 => "int oct ord w",
':' => "chr oct oct ord n",
';' => "chr sqrt hex daa",
'<' => "chr oct oct ord p",
'=' => "chr sqrt hex eaa",
'>' => "chr oct oct ord r",
'?' => "chr sqrt hex faa",
'@' => "chr oct ord d",
'[' => "chr oct oct hex cd",
"\\" => "chr oct oct hex ce",
']' => "chr oct oct hex cf",
'^' => "chr oct hex hex dfa",
_ => "chr log sqrt exp hex be",
'`' => "chr hex oct oct ord p",
'{' => "chr oct hex ad",
'|' => "chr oct hex ae",
'}' => "chr oct hex af",
'~' => "chr oct oct hex ord h",
);
$_ eq eval $code{$_} or die "Code '$_' (ascii " . ord . ") mismatch
+\n"
for sort keys %code;
undef $/;
$_ = <>;
while ( /([A-X][a-x]+) # 1
|([A-X][A-X]+) # 2
|([C-Z][c-z]+) # 3
|([C-Z][C-Z]*) # 4
|([AB]) # 5
|([a-y]+) # 6
|(z+) # 7
|(.)(\8*) # 8,9
/sgx
) {
$i = lc $+;
if ($1 || $2 || $3 || $4 and 1 + eval { prototype "CORE::$i" } and
+ !$@
or length ($4) == 1) {
$j = $1 || $2 ? "y" : "b";
$i = "q $j$i$j";
}
if ($1) { $s = "s zzucfirst ${i}ze";
} elsif ($2) { $s = "s zzuc ${i}ze";
} elsif ($3) { $s = "s aaucfirst ${i}ae";
} elsif ($4) { $s = "s aauc ${i}ae";
} elsif ($5) { $s = "s zzuc q y${i}yze";
} elsif ($6) { $s = "s zz${i}z";
} elsif ($7) { $s = "s aa${i}a";
} elsif ($code{$8}) {
unshift @s, "s zzchr ordze"
for 1 .. length $9;
$s = "s zz$code{$8}ze";
} else {
die "Unknown symbol '$8'\n";
}
unshift @s, $s;
}
$_ = (join " x ", @s[@s/2 + 1 .. $#s], "eval if ")
. (join " x ", @s[0 .. @s/2]);
s/(.{1,79})( |$)/$1\n/g;
s#(.+)#
$_ = $1;
s/^(.{${\(int rand length)}} )/$1 /
while 79 != length;
$_
#eg;
print;
Update 23-APR-02: source slightly modified.