password_funcs.php File Reference

Go to the source code of this file.

Functions


Function Documentation

tep_encrypt_password ( plain  ) 

Definition at line 28 of file password_funcs.php.

Referenced by customer::userInsert(), and customer::userUpdatepassword().

00028                                         {
00029     $password = '';
00030 
00031     for ($i=0; $i<10; $i++)
00032       $password .= tep_rand();
00033 
00034     $salt = substr(md5($password), 0, 2);
00035     $password = md5($salt . $plain) . ':' . $salt;
00036     return $password;
00037   }

tep_validate_password ( plain,
encrypted 
)

Definition at line 14 of file password_funcs.php.

Referenced by customer::CheckMailAndPass(), and customer::checkPasswordProcess().

00014                                                      {
00015     if (tep_not_null($plain) && tep_not_null($encrypted)) {
00016       // split apart the hash / salt
00017       $stack = explode(':', $encrypted);
00018       if (sizeof($stack) != 2) return false;
00019       if (md5($stack[1] . $plain) == $stack[0]) return true;
00020     }
00021     return false;
00022   }