Do you know the Name of the user before you issue a serial? Because in this case the most straightforward way would be to generate a salted hash out of the user name and issue this as serial. In your program you just generate the hash too and check it against the inserted serial.
Not really secure (and there are a lot of factors that can make it really insecure), but it works and is easy to implement. I would go with a long hash like SHA2 256 or even longer to avoid collisions and brute forcing a valid key.
What is the crypto library? and how would I implement it?
There is no such thing as THE crypto library, but many crypto libraries that implement different algorithms. Depending on what you want, you would pick one. Your best bet would be an BSD or MIT licensed library, its open source but no copy left bullshit like the GPL.
The FreeBSD project includes a good crypto library that can generate hashes, OS X implements the excellent commoncrypto library which is also Open Source and can be found here
http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-36064/