The rule on encryption is: DON'T implement it yourself.
Even if you know how the algorithm works, there are so many pitfalls, that you will most likely stumble over all of them. Use an existing crypto library that has been audited by more than 10 people and has already been used in a few projects.
If you want to protect your game from being pirated, forget it now. Its not worth the effort beside that it is a great way to get free advertisement. When my App got pirated, my sales went up by 200% (50 sales/day), so better use this. Beside that the people who really don't want to pay for your program (for whatever reason) aren't going to pay anything, no matter how much protection you put on top of it. And like encryption, you will do it wrong anyway.