View Single Post
  #4 (permalink)  
Old 09-13-09, 05:45 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
I looked at this and what they do is store the MD5'd user password along with a random salt. Here's the code snippet that does that:

$salt = random(6);
$password = md5(md5($password).$salt);


First they create a random salt, then they append the salt to the password and MD5 it, then they MD5 the result again. Finally they do the insert into the DB, storing the salt:

INSERT INTO {$tablepre}members (username, password, salt, ..... etc

You can't really "undo" an MD5 function, but by using the same function with the stored salt value, you could create the same MD5 digest of the password for use in your system. The user could then login with the same password
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote