What methods / libraries / tools would people suggest for generating license keys (those lovely AAAAA-AAAAA-AAAAA-AAAAA-AAAAA things you put in when you register software)?Any gotchas to look out for when implementing them?(At the moment I'm interested in this as a general thing rather than language specific so just state what language you're using if your solution is language specific). 
Best Mechanism for Generating License Keys
licensing
It's about the same as when storing passwords. You should have a unique secret key known only to the generator and your program. Use this key to manipulate the details (user name, password, organization, etc) and then hash it. You can then do something trivial transfer encoding in Base32 on the hash or simply move it to a hex string if you don't care about a format.Any gotchas to look out for when implementing them?Keep secrets secret and separate.  Make your implementation improvable. If someone breaks it can you easily change the implementation? One common implementation on desktop applications is to use a remote server to validate the license. This removes the possibility that someone could reverse engineer a hash or the algorithm by inspecting the application itself.