Python obfuscation

Mike Meyer mwm at
Thu Nov 10 23:02:18 CET 2005

"Ben Sizer" <kylotan at> writes:
> For example, I'd like to write a game in Python. I'd like to give the
> game away free and charge for extra content. In C++ I can make it
> difficult for users to share content with others who haven't paid for
> it, with cryptographic hashes and the like. No, not impossible, but
> difficult enough to deter most people. In Python it's much harder, when
> the end user can open up the relevant file and quickly remove the
> license check. No doubt this is another of the reasons why Python isn't
> catching on quickly for game development, sadly.

What makes you think this is the case? There are ways to distribute
Python modules so that the user can't just open them in a text
editor. There are also ways to get cryptographic security for
distributed modules. Yes, if you use the same methods you use in C++,
it's "much harder". But by the same token, if you tried to use the
methods you'd use in a Python program in C++, you'd find that the C++
version was "much harder".

Of course, as Alex pointed out, all of these are just keeping honest
people honest. The crooks have all the advantages in this game, so you
really can't expect to win.

Not that I'm convinced that putting everything on a "secure server" is
proof against getting your code stolen. Last time I was involved with
security people, it was commonly acknowledge that there were two types
of security people: those who knew when their systems were last broken
into, and those who didn't. Source - and other things - gets stolen
from "secure servers" on a regular basis, and those machines don't
have to provide some way for the potential thieves to execute the
code. But at least with this model, some of the advantages are on your
side, so you stand a fighting chance.

Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list