I took down this Gist due to concerns about the security of the encryption/decryption part of this code (see comments below).
Rob Napier (@rnapier) has created a publicly available class that provides similar AES encryption/decryption functionality at https://github.com/rnapier/RNCryptor.
This code is dangerously insecure. Fine if you're just using it as the copy protection keygen for your application, or to protect high scores. Not fine for anything else.