It started on IRC, while I was trying to be tricky with an obfu :...

Continue on to read the exciting adventures of boo_radley on IRC!

<booradley> $_=""; <booradley> if (samanda) {print "eek"} <booradley> then <booradley> $_="m"; <booradley> if (samanda) {print "eek"} <booradley> the first one tests true, but the second doesn't. Why? <ar0n> samanda? <ar0n> Where is samanda defined? <booradley> ah ah <ar0n> Whhat <booradley> it's not defined at all. <booradley> I though it would be interpreted as : <booradley> $_="m"; <booradley> if (s amanda) {print "eek $_"} <booradley> (to be a little clearer) <Juerdje> deparse it
TIME PASSES AND THE CODE IS DEPARSED
<Juerdje> samanda seems to be an unquoted string, and therefore always true <booradley> aah <Juerdje> which will get optimized away <Juerdje> so there's no if(){} at all in the deparsed result <Zaxo> work like you want for me, with the space affter s <Juerdje> with the space after it, it'll be interpreted as s/m/nd/ <Juerdje> space is only optional for a non-whitespace non-alphanumeric character <booradley> I thought the separator/ delimiter rules of s/// would tak +e precidence, but I guess that was stupid :-) <Juerdje> (afaik, you can't use whitespace as a delimiter in current versions anymore) <Juerdje> booradley: if the space were optional, it'd be a regex, but the space can only be left out for non-alphanumeric characters
CHAPTER 3 : Too Tricky For His Own Good!
*booradley tries using a unicode character for a delimiter. <Juerdje> hmmm <booradley> keen <booradley> unicode will usher in a new world of obfu :-) <Juerdje> it works? <booradley> yep <Juerdje> omg <booradley> sámándá <booradley> HOO HOO HA HA HA <Juerdje> omfg <booradley> pheer <Juerdje> is that unicode? <Juerdje> looks like a normal chr(255) <Juerdje> hmmm <Juerdje> 225
The character I used was (A + COMBINING GRAVE ACCENT), but I wonder if this was a result of my editor, or one of our IRC clients translating the character into something else? Here's a small example which works appropriately (or my estimation of appropriately)
$_="I am you"; print if (sámándá);

does this work because my locale has no (A + COMBINING GRAVE ACCENT) defined, and treats it as a non alpha numeric? or are unicode characters outside the realm of alphanumeric characters as perl currently knows them?

I'm curious to hear your comments or opinions.

Replies are listed 'Best First'.
(crazyinsomniac) Re: Unicode and the fine art of obfuscation
by crazyinsomniac (Prior) on Dec 20, 2001 at 09:59 UTC
    How is á unicode? It's just high bit ascii isn't it? anyway, I beat you to the punch (and probably others) as I've used high ascii in an obfu. I'm quite fond of ˇ, ¤, and especially °;

     
    ___crazyinsomniac_______________________________________
    Disclaimer: Don't blame. It came from inside the void

    perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"