I'm interested in creating license keys for my applications and already thought of a system how the activation will be done to have a minimum of copying security without having to hassle my customers. Also, I am well aware that there is no absolute way to prevent piracy, I don't mind afterall.
I'm more interested in general key generation. The first way I can think of is creating a hash, using SHA, MD5 or any other popular one-way-algorithm. Those hashes are (mostly) short and easy to enter for a customer. But at the same time, I would like to include additional data in the generated activation key which I want to decrypt inside the application on customers side. But most algorithms that encrypt data using a key result in random length phrases that can easily be > 300 chars long.
Is there an algorithm that encrypts a string into a ciphered text with a pre-defined length or pattern, that can be decrypted afterwards?