[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Key / Serial nr generator PHP script

Posted on 2009-04-01
6
Medium Priority
?
516 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 1500 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

656 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