From: James Gray Date: 2008-05-23T05:05:19+09:00 Subject: Re: [SUMMARY] Obfuscated Email (#163) On May 22, 2008, at 2:24 PM, Matthew Moss wrote: > Welcome, Ruby coders and coderettes... Tonight we bring you the Obfu > Awards, > awards given by committee (i.e. me) to those most deserving for > their... > "creative" work. > > We're going to skip the red carpet frivolities, as we have no red > carpet, > and jump right to the awards. Here they are, in no particular order > (except > that of their entry). Your summaries are always more fun than mine were! ;) > #### Most Painful Obfuscation > > The first entry from _Mikael Hoilund_ is such a dangerous minefield of > string manipulations and punctuation, the committee could not > completely > discern its operation. In particular, putting aside the call to > `downcase!` > (which we managed to discern after much coffee and doses of > Ritalin), this > segment of code was never fully understood: > > *a=e=?=,!????,:??,?,,Email > > We'd ask Mikael to explain himself to the committee, but we fear the > medical > consequences. Ouch. Let's break it down. First we need to get it to run: >> Email = Object.new => # >> *a=e=?=,!????,:??,?,,Email => [61, 63, 44, #] It's just a really complex assignment, we can see. *a = … Slurp an Array into the variable a. … e = … And store the first value of that Array in e. … ?=, … The ASCII value of the character = (61). This next bit is very tricky. I had to play with it in IRb a bit to figure out how Ruby parses it, but it plays out as: … !?? ? ?, : ??, … The conditional is the opposite of the ASCII value of ? (always true, which not switches to false). If it was true, it would become the ASCII value of , (44). However, since it's always false it becomes the ASCII value of ? (63). The last bit is much easier: … ?,, Email That's just the ASCII value of , (44), followed by the contents of the Email constant. James Edward Gray II