Solved

Key / Serial nr generator PHP script

Posted on 2009-04-01
6
479 Views
Last Modified: 2012-05-06
Hi,

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 :
String : 20090401MYLICENSEJOHNDOE
Key or Serial nr : AHSH-D33D-DFKH-JF236-768D

Thanks in advance.

Phil
0
Comment
Question by:s2000_com
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:ollyatstithians
ID: 24039752
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:

http://uk3.php.net/manual/en/function.crypt.php
0
 
LVL 8

Expert Comment

by:mostart
ID: 24039798
as far as I can see on the php.net page crypt will not decrypt encrypted strings.

check mcrypt instead:
http://de3.php.net/manual/de/function.mcrypt-encrypt.php
0
 

Author Comment

by:s2000_com
ID: 24039878
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 ?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:s2000_com
ID: 24040106
Hi,

I'm searching for a PHP script similar to this tool :  http://ellipter.com/features/

The script must be able to create and revert the key.
0
 
LVL 8

Accepted Solution

by:
mostart earned 500 total points
ID: 24040192
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.
0
 

Author Closing Comment

by:s2000_com
ID: 31565323
I used a similar approach.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now