Features Podcasts Family Video Comics Music Tech Science Books Film & TV Games ✚

Jill

BB Obfuscated Code/Safari Books Online contest winner!

David Pescovitz at 11:50 am Wed, Nov 19, 2008

— FEATURED —

THE LATEST

Guatemala: Archive of documents from Rios Montt genocide trial, overturned 10 days after guilty verdict

THE LATEST

Guatemala: Nation's highest court throws out Ríos Montt genocide trial verdict and prison sentence

Feature

Eurovision 2013: An American in London

Book Review

The Twelve-Fingered Boy - mesmerizing YA horror novel

Book Review

Black Code: how spies, cops and crims are making cyberspace unfit for human habitation

— FOLLOW US —

Boing Boing is on Twitter and Facebook. Subscribe to our RSS feed or daily email.

 

— POLICIES —

Except where indicated, Boing Boing is licensed under a Creative Commons License permitting non-commercial sharing with attribution

 

— FONTS —

Tweet
Kindle
Lureour
Last week, we announced an Obfuscated code contest with a geektastic prize provided by our sponsor, Safari Books Online, who also offered BB readers one month free online access to any of the following books: JavaScript: The Definitive Guide, Learning Perl, and Head First HTML with CSS & XHTML. The goal was to write a wonderfully obfuscated code snippet that prints out the phrase "Boing Boing." The prize: one year of access to the complete Safari Books Online Library, a digital library of technical books from the likes of O'Reilly, Apress, and Addison-Wesley.

 Images Safari Logo-1 We were absolutely amazed by the entries. There are some incredible bits of code in there. But we had to pick one, so we did. Or rather Joel Johnson did, because this whole thing was his idea to begin with. So we are pleased to announce that the winner of the inaugural Boing Boing/Safari Books Online: MCD. The entry was pithy, clever, and got the job done (see above). Congratulations, MCD! And thanks to Safari Books Online for sponsoring the contest!

David Pescovitz is Boing Boing's co-editor/managing partner. He's also a research director at Institute for the Future. On Instagram, he's @pesco.

More at Boing Boing

Eurovision 2013: An American in London

The technology that links taxonomy and Star Trek

  • daen

    I’m sorry, but compared to the winner of the 2000 Obfuscated Perl contest, this is not especially wonderful. According to Les Peters, the author, this program comprises:

    two lines of code that parses two lines of embedded comments in the code to read the Mayan numbers representing the individual ASCII characters that make up the magazine title, rendered in 90-degree rotated ASCII art.

    Here it is in all its beauty. Bow down before it. C’mon, these are ASCII characters representing Mayan numbers representing ASCII characters! The man is an insane genius!

    #:: ::-| ::-| .-. :||-:: 0-| .-| ::||-| .:|-. :||
    open(Q,$0);while(){if(/^#(.*)$/){for(split('-',$1)){$q=0;for(split){s/\|
    /:.:/xg;s/:/../g;$Q=$_?length:$_;$q+=$q?$Q:$Q*20;}print chr($q);}}}print"\n";
    #.: ::||-| .||-| :|||-| ::||-| ||-:: :|||-| .:|
    

    It prints out … Well, why spoil it? Run the code, but have a guess first. Do you get it? Do you really get it?

  • Teresa Nielsen Hayden / Moderator

    It’s traditional to congratulate the winner.

    • Antinous

      Not in Mordor.

  • arkizzle

    I thought this was great!

    Well done all and MCD. I am not quite the obfuscation-connessiur that some here seem to be, but when I ran MCD’s code and BOInGBOInG popped out, I burst into a grin.

    Well done again! I will have to check out some other examples in the thread (which I somehow missed the first time).

  • finisterre

    > This little snippet would be a lot easier to try out if it wasn’t a f#$%ing jpg. Boo!

    Quite – http://lbrandy.com/blog/2008/10/my-first-and-last-webcomic/

  • daen

    C’mon, there should be a total mental disconnect in obfuscated code competitions between what you read in the code itself and what appears on the screen when you run it. Pithy and terse do not necessarily an obfuscated code winner make. There should ideally be hours of head-scratching and debugger work in figuring out how a three-line obfuscated C program can possibly print “Bloom County” in an elegant cursive ASCII art font, alongside versions of the strip’s main characters, with the O’s for Opus’s eyes. You should go blind and/or mad with frustration after picking apart the keyboard salad of obfuscated Perl that turns out to be a fully featured Atari 800 emulator, including the POKEY chip and joysticks. And so on. These kind of programs should look like invocation rites for some kind of demonic entity rather than an exercise in well structured code, and should leave you feeling as equally awestruck as if you had been in the Dark One’s presence, if not necessarily by virtue of the result then in the execution.

    I have said my piece.

    Congratulations to the winner, in traditional sour-grapes loser fashion.

  • Antinous

    Dude,

    You didn’t even enter the contest. That’s not sour grapes. That’s just a big steaming pile of fail.

  • Takuan

    honest, orcish, but honest

  • mdh

    if only he’d said his peace.

    (FYT)

  • McD

    Ahem. W00T! :-)

    Daen – you’re right, this doesn’t hold a candle to most obfuscated Perl. (Shoot, it’s cleaner than some production code.) But the original call was for “…the shortest, most elegant, or creative bit of code” – and to that end, I thought this fit the bill perfectly. Brevity being the soul of wit, and all that, you know.

    And for Naomind, the code simply takes advantage of an obscure feature of Perl that SamSam noticed, documented here. If you increment a non-numeric string, you get a “string increment” with carry. So you can get from “McD” to “BOInG” just by incrementing a number of times – but (as in so much of life), the real trick is knowing when to stop.

    Congratulations to all the competitors, there’s some truly baffling code in there. I’ll leave you with a quick link to my favorite obfuscated Perl of all time, Erudil’s classic Camel Code.

    Peace,
    -McD

  • mdh

    I’m sorry, but

    ahem, you forgot to close your b.s. tag there.

  • Joel Johnson

    It was close enough. :)

    And honestly, almost every entry was amazing. You guys should really go check out the other ones.

  • ricket

    This little snippet would be a lot easier to try out if it wasn’t a f#$%ing jpg. Boo!

  • Anonymous

    I guess I’ve been in the mines too long; it seems like pretty straightforward perl to me.

    I was playing games with I/O buffer width and ephemeral pseudo-devices in mine, but I suppose nobody else found it amusing. Such things are most likely taken for granted in the post-x86 world… Oh well.

    Congratulations, McD! Well played!

    –Charlie

  • Anonymous

    This must be a sign. I just found Safari Books Online yesterday, they have a large selection at an OK-ish price. It was almost too good to be true, there had to be a catch, like some sort of DRM or something. But I trust BoingBoing not to be sponsored by some scam.

  • SamSam

    Ha! That’s pretty good: Simplicity itself if you know that you can ‘++’ a string, but very difficult to work out what it will print in advance without actually running it.

  • sardonicbastard

    Well, let me be the first to point out that the program doesn’t print out the string “Boing Boing.” and should thus be ineligible for the contest… but hey, you guys make the rules.

  • Galoot

    My feed reader didn’t show the .jpg, so I couldn’t read the code until I came here directly. But as soon as I saw that Joel chose MCD’s entry I immediately thought, “Oh, the memorable one!”

    Great choice. Congrats, McD.

    Joel, I give up. What does “lureour” (the <alt> text) mean?

  • KWillets

    Didn’t James Joyce once win an obfuscated literature contest?

  • naomind

    That looks really cool. Could one of you Perl coders kindly explain how this script works? Inquiring minds want to know.

  • Anonymous

    A tech writer I know once referred to these obfuscation contests as “carrying coals to Newcastle.”

    As a working coder confronted with Perl and even COBOL on a regular basis, I can only concur.