diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-09-27 01:19:55 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2013-09-28 03:14:18 +0200 |
commit | c6aefcf555b51e7bcf00332290c9d94beddec02c (patch) | |
tree | f75fd34bafa8699cbe4e4e5cf875dd4d5cf4b33e /tests/security | |
parent | cba28c39ad63920c05241f59ce7e1ad6b47039df (diff) | |
download | forums-c6aefcf555b51e7bcf00332290c9d94beddec02c.tar forums-c6aefcf555b51e7bcf00332290c9d94beddec02c.tar.gz forums-c6aefcf555b51e7bcf00332290c9d94beddec02c.tar.bz2 forums-c6aefcf555b51e7bcf00332290c9d94beddec02c.tar.xz forums-c6aefcf555b51e7bcf00332290c9d94beddec02c.zip |
[ticket/11873] Add unit test for large password input.
The password should be rejected quite fast.
PHPBB3-11873
Diffstat (limited to 'tests/security')
-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); + } } |