Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Think about Loose Coupling
 
PerlMonks

Yet Another Obfuscation Engine

by mtve (Hermit)
 | Log in | Create a new user | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

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 (Monsignor) 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.

[reply]
[d/l]
[select]

Back to Obfuscated Code

Login:
Password
remember me
What's my password?
Create A New User

Node Status
node history
Node Type: obfuscated [id://161087]
Approved by jmcnamara
help
Community Ads
Chatterbox
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users
Others pondering the Monastery: (16)
GrandFather
graff
planetscape
atcroft
johngg
CardinalNumber
herveus
jethro
thezip
MidLifeXis
Eyck
zwon
JadeNB
ssandv
gnosti
im2
As of 2009-11-20 23:09 GMT
Sections
The Monastery Gates
Seekers of Perl Wisdom
Meditations
PerlMonks Discussion
Categorized Q&A
Tutorials
Obfuscated Code
Perl Poetry
Cool Uses for Perl
Perl News
Information
PerlMonks FAQ
Guide to the Monastery
What's New at PerlMonks
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Find Nodes
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Snippets Section
Code Catacombs
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Planet Perl
Perlsphere
Use Perl
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Perl Directory
Perl documentation
CPAN
Random Node
Voting Booth

Future historians will find that the material characteristic of the current era is...

Aluminium
Plastic
Oil
Water
Carbon dioxide
Copper
Iron
Silicon
Salt
Uranium
Hydrogen
Other

Results (724 votes), past polls