Benad's Web Site

So I just got by mail from Norway a bamboo USB key from Opera, the makers of the Opera web browser. How? Because I won a contest from their April fool’s. If you signed up to their bogus “we’ll send you data to offload our servers”, you would have gotten an email containing a bunch of ones and zeros. Of course, they were encoded messages. And here’s how I decoded them, using Perl and the pack function.

First, decoding the binary data. That was pretty easy:

perl -e '$_=<>;chomp;print pack(q{B*}, $_), qq{\n}'

That took care of the binary data. Now, the input was actually divided in two parts. The first decoded to a sequence of decimal numbers separated by spaces, the second some binary starting with the “BZh” which indicates Bzip2 data. Uncompress that and you see a message about posting a tweet with the hashtag #operaaprilfoolleet to be eligible to win some contest, which I did.

The first part with the sequence of decimal numbers was supposed to be easier (well, if you can’t recognize a BZip2 header). The big distinction here is that the pack function requires the input to be separator-less, in this case spaces. Since you can’t define decimal input padded as 3 digits, you’re stuck sending the input as an array instead, which works great.

perl -e '$_=<>;chomp;@f=split(/ /);print pack(q{C*}, @f), qq{\n}'

That gave me the first message, this time asking to post the hashtag #operaaprilfools, which I did.

With some luck I won the prize, an Opera-branded wood USB key, as you can see in the attached picture (or here).

Published on April 18, 2012 at 16:57 EDT

Older post: Server Bloat

Newer post: Kubrick Upgrade