Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Yet Another Obfuscation Engine

by mtve (Chaplain)
on Apr 22, 2002 at 16:13 UTC ( #161087=obfuscated: print w/ replies, xml ) Need Help??

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.

Comment on Yet Another Obfuscation Engine
Download Code
Re: Yet Another Obfuscation Engine
by ambrus (Abbot) on Mar 29, 2004 at 08:49 UTC

    Without knowing about this node, I wrote Re: Re: exactly 390 bytes.

    It is not a complete obfu-engine, just lists compact encoding of the first few numbers. For some punctation chars, it gives a bit shorter encoding than yours (while it has longer ones for most others). For example:

    _ = chr log sqrt exp hex be = chr oct hex ord uc yz

    From these encodings, I especially like those relying on that oct stops scanning a number when it meets a digit 9.

    What I find really strange is that expressions with length aaaaaaaaaaaaaa or those with length qr taaaaaat never give an optimal encoding.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://161087]
Approved by jmcnamara
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2014-09-16 02:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (155 votes), past polls