?
Solved

Key / Serial nr generator PHP script

Posted on 2009-04-01
6
Medium Priority
?
509 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

752 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