Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Thursday January 04, 2007
04:46 PM

Fonality's obfuscation hiring filters

[ #32072 ]

Fonality recently sponsored a Perl Golf competition with cash prizes as a way to draw attention to their open Perl positions. It's good to see the techies taking part in the human resources process and it sounds like it might be a good place to work.

Their junior Perl developer position says:

We're looking for eager, junior level Perl developers who are itching to work with world class Perl experts. If you can explain this:

s|(\d)|length(9 x $1)|eg;

We'd like to hear from you!

I figured that must be a trick question since it leaves $_ that same as when it started, although it did a lot of work to do that. It replicates the string 9 by the number it matched, takes the length of that, and uses it as the replacement. It's the same as not doing the substitution at all. It does have some side effects, but as a single line of code those really don't matter.

The senior Perl developer position isn't that much more challenging, although it is obfuscated:

:DEVELOPERS;s"$&"Ktsf"i;s^.^ch r ord($&)-5^eg;$\=$/;print||" ;) "

Using the techniques in my Mastering Perl chapter on "Cleaning up Perl" pretty much takes care of this. First, use B::Deparse:

$ perl -MO=Deparse snippet
s/(?:SEEKING)?/PERLqny~%|fsyx%~tz&/ ? $^X =~ /\w+$/ : '???';
s/./chr ord($&) - 5;/eg;
$\ = $/;
'???' unless print $_;

It's basically a Caeser cipher that moves everything up five places. It populates $_ by replacing nothing with the starting string. It's
interesting that it uses $^X, but that's really fragile. It assumes that the value is "perl", but I can also call this code with a perl
binary with a different name:

$ /usr/local/bin/perl5.8.8 snippet
K@MGlity wants you!

Not only that, but I'd expect a senior Perl developer to insist on strict and warnings clean code:

$ perl -Mstrict -w snippet
Bareword "DEVELOPERS" not allowed while "strict subs" in use at snippet line 1.
Execution of snippet aborted due to compilation errors.

That's easy to fix up though and I kinda like my way to get "perl":

`$^X -v`=~m/(?is)(?<=is\s\is.)\w+/:our $DEVELOPERS;s"$&"Ktsf"i;
s^.^chr ord($&)-5^egi;eval"format STDOUT=\n@*\n.";$^A=$_;write;

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.