Reputation: 909
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?
Upvotes: 0
Views: 584
Reputation: 10222
Since you want the license data to contain some information (probably customer name, expiration date etc), maybe you should consider generating a text file containing the encrypted data and send it to the customer. Then they can select that text file from the app instead of entering the license key.
If there is an online activation process, you can simply generate a random product key, send it to the client and check it against a central activation database and transfer all the license data to the client during the activation process.
Upvotes: 1
Reputation: 793
No. An encryption of data cannot be shorter than the length of the data string.
So if you want to include more information than a keycode, then you need use an encrypted license file (.lic) which they can import or copy-and-paste its content into a form.
Upvotes: 0