Skip to content

Commit

Permalink
preserving backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lota committed Dec 7, 2016
1 parent f15a8b3 commit 02bc9fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions controllers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,15 @@ function phamm_password_hash($password_clear)
case 'crypt':

$salt = (defined(CRYPT_SALT) ? CRYPT_SALT : 'random');
$salt_lenght = (defined(SALT_LENGTH) ? SALT_LENGTH : PASSWORD_MIN_LENGHT);

switch (strtolower($salt))
{
case 'password':
$password_hash = '{CRYPT}'.crypt($password_clear, substr($password_clear,0,SALT_LENGTH));
$password_hash = '{CRYPT}'.crypt($password_clear, substr($password_clear,0,$salt_lenght));
break;
case 'random':
$password_hash = '{CRYPT}'.crypt($password_clear, random_password(SALT_LENGTH));
$password_hash = '{CRYPT}'.crypt($password_clear, random_password($salt_lenght));
break;
default:
$password_hash = '{CRYPT}'.crypt($password_clear, $salt);
Expand Down

0 comments on commit 02bc9fb

Please sign in to comment.