diff options
author | Jakub Zalas <jakub@zalas.pl> | 2015-12-17 18:04:54 +0000 |
---|---|---|
committer | Jakub Zalas <jakub@zalas.pl> | 2015-12-17 18:04:54 +0000 |
commit | f19082239fd48c17e8d99b252215f0172dc1ff14 (patch) | |
tree | 574d27bf3dfb8e6d60c33b72c465a3b56f47ce78 /Tests/Core/Encoder/BCryptPasswordEncoderTest.php | |
parent | c6e2323b707734f39941e57bf39df8ab85ccf6c3 (diff) | |
download | symfony-security-f19082239fd48c17e8d99b252215f0172dc1ff14.zip symfony-security-f19082239fd48c17e8d99b252215f0172dc1ff14.tar.gz symfony-security-f19082239fd48c17e8d99b252215f0172dc1ff14.tar.bz2 |
[Security] Verify if a password encoded with bcrypt is no longer than 72 characters
Diffstat (limited to 'Tests/Core/Encoder/BCryptPasswordEncoderTest.php')
-rw-r--r-- | Tests/Core/Encoder/BCryptPasswordEncoderTest.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Tests/Core/Encoder/BCryptPasswordEncoderTest.php b/Tests/Core/Encoder/BCryptPasswordEncoderTest.php index 076d954..52d64a2 100644 --- a/Tests/Core/Encoder/BCryptPasswordEncoderTest.php +++ b/Tests/Core/Encoder/BCryptPasswordEncoderTest.php @@ -73,13 +73,15 @@ class BCryptPasswordEncoderTest extends \PHPUnit_Framework_TestCase { $encoder = new BCryptPasswordEncoder(self::VALID_COST); - $encoder->encodePassword(str_repeat('a', 5000), 'salt'); + $encoder->encodePassword(str_repeat('a', 73), 'salt'); } public function testCheckPasswordLength() { $encoder = new BCryptPasswordEncoder(self::VALID_COST); + $result = $encoder->encodePassword(str_repeat('a', 72), null); - $this->assertFalse($encoder->isPasswordValid('encoded', str_repeat('a', 5000), 'salt')); + $this->assertFalse($encoder->isPasswordValid($result, str_repeat('a', 73), 'salt')); + $this->assertTrue($encoder->isPasswordValid($result, str_repeat('a', 72), 'salt')); } } |