How to ReHash a password stored into my Database ? (PHP)

Posted by Vincent Roye on Stack Overflow See other posts from Stack Overflow or by Vincent Roye
Published on 2011-01-16T19:47:14Z Indexed on 2011/01/16 19:53 UTC
Read the original article Hit count: 167

Filed under:
|

Hi!

I have some passwords encrypted in my database and I would like to find a way to display them. Here is how they are saved into my mysql database:

function generateHash($plainText, $salt = null){

                if ($salt === null)
  {
   $salt = substr(md5(uniqid(rand(), true)), 0, 25);
  }
  else
  {
   $salt = substr($salt, 0, 25);
  }

  return $salt . sha1($salt . $plainText);
 }

        $secure_pass = generateHash($this->clean_password);

Then $secure_pass is saved into my database.

Anyone would have an idea ??

Thank you very much ;)

© Stack Overflow or respective owner

Related posts about php

Related posts about md5