Key / Serial nr generator PHP script


I'm searching for a PHP script creating a key or serial nr (containg only basic chars : 0-9 / A-Z) based on a String. I have to be able to revert the key / serial number to get back the String.

Example :
Key or Serial nr : AHSH-D33D-DFKH-JF236-768D

Thanks in advance.

Who is Participating?

Improve company productivity with a Business Account.Sign Up

mostartConnect With a Mentor Commented:
hmm.. I can't give you the 100% answer here. But I'do it like this:

1.) create hash (using hash() function to create hash key from string)
2.) store that hash in my Database along with the information associated
3.) comparing the hash with the ones stored in the database to verify the key

This way cou make sure nobody can find out how your hash/key is generated. Any encryption/decryption would leave an attacker the possibility of brutforcing/cracking it.
Also this way you can format the key to fit your needs.
The crypt() function can produce a hash from a seed string, and then turn it back again. This is the basis of many (all?) encrypted password systems.
Have a look in the PHP manual:
as far as I can see on the page crypt will not decrypt encrypted strings.

check mcrypt instead: 
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

s2000_comAuthor Commented:
ollyatstithians: It seems that mostart is right !

mostart: I tried mcrypt but the encrypted string contains other chars than 0-9 / A-Z

I need a generator script which can produce string like the one we can see when you activate a product like Windows, Office or others.

Any other suggestions ?
s2000_comAuthor Commented:

I'm searching for a PHP script similar to this tool :

The script must be able to create and revert the key.
s2000_comAuthor Commented:
I used a similar approach.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.