This is my first and probably last (intentional) obfu.

This command line works on Windows and *nix, UTF8 enabled or not.

perl -e "map {s/Z/\x24/g;eval()}map{m/(.*)/}q{map{Z\.=chr(96+(Zb|Z_>> +4&63||0xc0)&255);Zb=Z_<<8>>4&0xf0 }map{ord}map{utf8::decode(Z_);m/([^ +Â])/g}qq(¡Q1@\0\cPàñ@\xc2\x80Q \cA\0Q À\0\xc2\x80\cP0°Q );Z\.=qq[,\n] +,print''}"

I'd be interested to see how you could do this with pack/unpack.

Clint

Update - now with the trailing comma, as pointed out by agianni

Replies are listed 'Best First'.
Re: JAPH with shifting (explained)
by clinton (Priest) on Aug 21, 2007 at 10:16 UTC
    As nobody has commented on this (not sure if that's because it's too ugly or just rubbish), I've added an explanation of the code below. It's nowhere near as clever as I wanted it to be. But the same thing could probably be said of me.

    The one liner runs from the command line in (at least) Windows and Linux, and copes with UTF8 or Latin-1 character sets.

    For each chunk of code, I present the original code, then explain it in order of execution.

    Clint

      I like it - I think the shifting stuff is cool. Could it be adapted to become a uuencoder (sans obfu) or something else cool? Did a real world example inspire you to work on this?

      I'm too new to Perl to be able to de-objuscate. I appreciate the explaination. (I'll write one up on my own soon).


      I humbly seek wisdom.
        I know very little about uuencoding and even less about pack/unpack, but I have a sneaking suspicion that pack/unpack would be the way to go with that. Could somebody give an example of this?

        The "inspiration" came from using a hex editor to debug UTF8 issues, and originally, I wanted to use the bytes from UTF8 characters in a sentence to hold the latin bytes for "just another Perl hacker,". But of course the first 255 characters in UTF8 and Latin-1 are the same, so I couldn't do it without resorting to a different script within UTF8, which would mean that it wouldn't work on many machines.

        So I settled for making it unreadable instead :)

        Clint