

Obfuscating “Hello World” in Python - carljoseph
http://benkurtovic.com/2014/06/01/obfuscating-hello-world.html

======
manto
When I first saw the final code, I thought it unfathomable that I could
resolve it down to "Hello World!" at any point in my lifetime. The following
20min provided an education into logic, programming, and Python that rivals
200 page reference books with clear explanations and the ideal amount of build
up for each step. Thanks Ben for the post!

------
rrosen326
I thought this was a great post, some amazing code, and humbling since this is
WAY beyond my current - and future - ability.

Even more impressive - it looks like the author is a freshman in college!
[https://www.linkedin.com/in/benkurtovic](https://www.linkedin.com/in/benkurtovic)

Nice work, Ben!

~~~
yuncun
Damn. If I was a freshman in his CS class I would hate his guts.

~~~
dmd
Can you explain why? I don't really understand this sentiment at all.

~~~
sooheon
It's a human emotion called jealousy.

------
hawkice
This is perhaps the clearest example on the value of implementation-oriented
code comments. When you need them, they are superheroic. But... don't need
them, please.

------
userbinator
I barely know any Python and upon first glance I could easily get an idea of
how it worked (without looking at the explanation): by computing the required
strings out of funny-named variables with shifts and arithmetic. co_nlocals is
obviously the only actual integer constant from which all the other values are
coming from.

Only then did I read the explanation, and realised I wasn't far-off (the only
thing I got wrong was the string computation, which I thought would be a
string concatenation.) I think it says something about the language when even
_obfuscated_ code in it is rather readable! (Then again, I do RE where most of
the code I'm reading is disassembled machine instructions, so maybe my
perspective on what constitutes obfuscation is a bit skewed...)

------
axotty
"There should be one-- and preferably only one --obvious way to do it."

~~~
ajuc
I don't think this counts as "obvious".

BTW my intuition say turing completness require that there are many ways to do
it, for at least some values of "it", but I can't proove it.

~~~
ema
Since turing completness implies that you can write an interpreter for any
other programming language you can do it in python in at least as many ways as
there are programming languages where you can do it.

------
dangayle
I saw this yesterday and shared it with a friend who had introduced me to code
golf. Simply fantastic, particularly the comments.

------
cogburnd02
I didn't realize there needed to be an IOPCC but now I do.

------
WillyNourson
This is like brainf*ck to me.

~~~
whichdan
Brainfuck relies on pointer arithmetic, while this is using bit shifting.

Brainfuck commands:
[http://en.wikipedia.org/wiki/Brainfuck#Commands](http://en.wikipedia.org/wiki/Brainfuck#Commands)

Bit shifting:
[http://stackoverflow.com/a/141873/58740](http://stackoverflow.com/a/141873/58740)

------
curiously
the level of obfuscation is impressive. i wonder if similar obfuscation for
javascript exists? The one from google doesn't seem to quite work right and
end up breaking my script. The paid version from jscrambler seems to work but
seems like a large waste of money to obfuscate one file.

------
gbersac
This code is so ugly that I thought it was Lisp :p

