Some time ago Sandra King started a thread in this forum about turning the code into some kind of serial number. Read this:
http://moodle.org/mod/forum/discuss.php?d=151299
I'm not sure if there is a working solution by now, but maybe some posts in this thread contain ideas or code suitable for you.