Writing a Starcraft CD-Key Generator
For the benefit of those who didn’t know, Starcraft is an old RTS game, the 2nd one I’ve been playing since 1997, and the only one that I’m still playing on and off after 10 years. It’s so old that I don’t even know where my box and manuals for it (most likely tossed away when I moved a long time ago).
And that’s annoying if you ever wanted to play old games you’ve bought.
While CD-Key generators and hack tools for Starcraft have been floating on the net since time immemorial (remember Razor 1911 anyone?), I’ve always been interested in how it’s been done. Well, someone has recently wrote about reverse-engineering Starcraft’s CD key algorithm, which answered my question, and I’m quite surprised that the algorithm is really quite straightforward.
Just for interest, I wrote an online implementation of the algorithm, but since my physical box is being shipped and I don’t have a hosting provider at the moment, I’ll rely on the only freely available service I know of, Google’s App Engine.
This forces me to pick up Python because Google App Engine does not support Ruby. Luckily, computer languages are usually near dialects of each other and Python is quite similar to Ruby or Perl, which makes learning easier.
All in all, it took me a day just to learn Python/Django Templates/App Engine and writing up the application, so I am rather pleased with the result. Here’s the web implementation of the algorithm hosted at http://cd-keys.appspot.com. The online application has additional code that showcases the database API for App Engine. The code is GPL’ed and freely available here.
While I think the simplicity of Google’s Application hosting is great, but in terms of having to be forced into a different environment. I didn’t really enjoy Django’s templating engine, compared to Haml/Sass, which I feel is more powerful and expressive, and that’s the same comparing Google’s Database API with Ruby Sequel. But the trade-off to using Google’s API is that I don’t need to monkey-wrench the guts of an RDBMS myself.
On the overall, Google App Engine is really not a bad service, and I really hope they’ll start supporting Ruby as an operating environment in the future. That will tip the scales to their favour for me to consider their hosted service rather than running a custom server on my own.