mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/passwords] Do not hash passwords longer than 4096 bytes
PHPBB3-11610
This commit is contained in:
parent
3ebff0a960
commit
61e4c0f251
1 changed files with 14 additions and 0 deletions
|
@ -191,6 +191,13 @@ class manager
|
||||||
*/
|
*/
|
||||||
public function hash_password($password, $type = '')
|
public function hash_password($password, $type = '')
|
||||||
{
|
{
|
||||||
|
if (strlen($password) > 4096)
|
||||||
|
{
|
||||||
|
// If the password is too huge, we will simply reject it
|
||||||
|
// and not let the server try to hash it.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$type = ($type === '') ? $this->type : $type;
|
$type = ($type === '') ? $this->type : $type;
|
||||||
|
|
||||||
if (is_array($type))
|
if (is_array($type))
|
||||||
|
@ -230,6 +237,13 @@ class manager
|
||||||
*/
|
*/
|
||||||
public function check_hash($password, $hash)
|
public function check_hash($password, $hash)
|
||||||
{
|
{
|
||||||
|
if (strlen($password) > 4096)
|
||||||
|
{
|
||||||
|
// If the password is too huge, we will simply reject it
|
||||||
|
// and not let the server try to hash it.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// First find out what kind of hash we're dealing with
|
// First find out what kind of hash we're dealing with
|
||||||
$stored_hash_type = $this->detect_algorithm($hash);
|
$stored_hash_type = $this->detect_algorithm($hash);
|
||||||
if ($stored_hash_type == false)
|
if ($stored_hash_type == false)
|
||||||
|
|
Loading…
Add table
Reference in a new issue