diff options
author | Andreas Fischer <bantu@phpbb.com> | 2013-09-28 15:02:59 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2013-09-28 15:02:59 +0200 |
commit | 787784e08335ef3c8d0d2955a1687afcec0f4cf9 (patch) | |
tree | b911ca7844e1abfa9879aac6dc2af3354d6a90c0 /tests | |
parent | 08b49203b48dc0bf3e1d851776288483065cf399 (diff) | |
parent | 02f9d179e541cf462e042774f6438263459926a3 (diff) | |
download | forums-787784e08335ef3c8d0d2955a1687afcec0f4cf9.tar forums-787784e08335ef3c8d0d2955a1687afcec0f4cf9.tar.gz forums-787784e08335ef3c8d0d2955a1687afcec0f4cf9.tar.bz2 forums-787784e08335ef3c8d0d2955a1687afcec0f4cf9.tar.xz forums-787784e08335ef3c8d0d2955a1687afcec0f4cf9.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[prep-release-3.0.12] Update changelog for 3.0.12 release.
[ticket/11873] Add unit test for large password input.
[ticket/11873] Do not hash very large passwords in order to safe resources.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/security/hash_test.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/security/hash_test.php b/tests/security/hash_test.php index 0c2580c19b..e226365ef3 100644 --- a/tests/security/hash_test.php +++ b/tests/security/hash_test.php @@ -17,5 +17,13 @@ class phpbb_security_hash_test extends phpbb_test_case $this->assertTrue(phpbb_check_hash('test', '$P$9isfrtKXWqrz8PvztXlL3.daw4U0zI1')); $this->assertFalse(phpbb_check_hash('foo', '$H$9isfrtKXWqrz8PvztXlL3.daw4U0zI1')); } + + public function test_check_hash_with_large_input() + { + // 16 MB password, should be rejected quite fast + $start_time = time(); + $this->assertFalse(phpbb_check_hash(str_repeat('a', 1024 * 1024 * 16), '$H$9isfrtKXWqrz8PvztXlL3.daw4U0zI1')); + $this->assertLessThanOrEqual(5, time() - $start_time); + } } |