diff options
author | Andreas Fischer <bantu@phpbb.com> | 2013-09-28 15:02:44 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2013-09-28 15:02:44 +0200 |
commit | 02f9d179e541cf462e042774f6438263459926a3 (patch) | |
tree | eb80a3852453b64b1f80a636a7a0f85d2eb57188 /tests | |
parent | 50f6af2a207dc18c1e76b08201a5c9ea640e921f (diff) | |
parent | 446ea9928d8373cf7695d3adda6d5ee30d5f94b4 (diff) | |
download | forums-02f9d179e541cf462e042774f6438263459926a3.tar forums-02f9d179e541cf462e042774f6438263459926a3.tar.gz forums-02f9d179e541cf462e042774f6438263459926a3.tar.bz2 forums-02f9d179e541cf462e042774f6438263459926a3.tar.xz forums-02f9d179e541cf462e042774f6438263459926a3.zip |
Merge branch 'prep-release-3.0.12' into develop-olympus
* prep-release-3.0.12:
[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); + } } |