diff options
| author | Marc Alexander <admin@m-a-styles.de> | 2013-10-02 15:33:17 +0200 | 
|---|---|---|
| committer | Marc Alexander <admin@m-a-styles.de> | 2013-10-02 15:43:10 +0200 | 
| commit | 3aba3235d5590efc6fbccd537641ebc87b3cfbfa (patch) | |
| tree | dd800e1f97a84b54665a8764d64d2b673c8ce59d | |
| parent | afb7d2e616db95add3c6ad9cc908df4218c6f3b7 (diff) | |
| download | forums-3aba3235d5590efc6fbccd537641ebc87b3cfbfa.tar forums-3aba3235d5590efc6fbccd537641ebc87b3cfbfa.tar.gz forums-3aba3235d5590efc6fbccd537641ebc87b3cfbfa.tar.bz2 forums-3aba3235d5590efc6fbccd537641ebc87b3cfbfa.tar.xz forums-3aba3235d5590efc6fbccd537641ebc87b3cfbfa.zip | |
[feature/passwords] Use passwords manager in phpBB hash functions
PHPBB3-11610
| -rw-r--r-- | phpBB/includes/functions.php | 43 | 
1 files changed, 6 insertions, 37 deletions
| diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b3e50847fd..c49c1d809b 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -398,38 +398,10 @@ function still_on_time($extra_time = 15)  */  function phpbb_hash($password)  { -	$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; - -	$random_state = unique_id(); -	$random = ''; -	$count = 6; - -	if (($fh = @fopen('/dev/urandom', 'rb'))) -	{ -		$random = fread($fh, $count); -		fclose($fh); -	} - -	if (strlen($random) < $count) -	{ -		$random = ''; - -		for ($i = 0; $i < $count; $i += 16) -		{ -			$random_state = md5(unique_id() . $random_state); -			$random .= pack('H*', md5($random_state)); -		} -		$random = substr($random, 0, $count); -	} - -	$hash = _hash_crypt_private($password, _hash_gensalt_private($random, $itoa64), $itoa64); - -	if (strlen($hash) == 34) -	{ -		return $hash; -	} +	global $phpbb_container; -	return md5($password); +	$passwords_manager = $phpbb_container->get('passwords.manager'); +	return $passwords_manager->hash($password);  }  /** @@ -442,13 +414,10 @@ function phpbb_hash($password)  */  function phpbb_check_hash($password, $hash)  { -	$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; -	if (strlen($hash) == 34) -	{ -		return (_hash_crypt_private($password, $hash, $itoa64) === $hash) ? true : false; -	} +	global $phpbb_container; -	return (md5($password) === $hash) ? true : false; +	$passwords_manager = $phpbb_container->get('passwords.manager'); +	return $passwords_manager->check($password, $hash);  }  /** | 
