I implemented the key system myself, but I used some open-source code for the hashing function. The system works by using the key as a shared secret - you know your key and my server knows your key so I can tell if your key is correct by asking you some questions about your key. The questions are cleverly designed such that no (or at least very little) information about your key is sent over the internet and that the correct answers very difficult to guess.
There's also a trivial client-side parity check to detect valid keys, but it could easily be defeated in a number of ways. I didn't put too much effort into that part since it's impossible and pointless to try to control what people do on their own computers and online play is where the money is.
However, all of this is meaningless to you, because what you should be doing is making your game. The first you make a free game that everyone in the world wants to play, then you can charge money for it, then you can worry about protecting it. Don't waste your time protecting something that nobody wants to steal. I literally made the key system work just weeks before shipping Blockland.
Also note that it only works in Blockland because it costs money to get a key. If you were giving out keys with your free game then people could just get more than one, defeating the whole purpose.