Solved

Key / Serial nr generator PHP script

Posted on 2009-04-01
6
490 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

839 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