I've written serial key activation algorithms years ago but don't remember how I did it.

Does anybody have any examples of how to do it so I can learn from it and write one for my program?

I looked all over the internet but cannot find anything.