Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to remove support for user provided salt.
- Loading branch information
1 parent
50fdd7d
commit 3d5541b
Showing
5 changed files
with
85 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
tests/JeremyKendall/Password/Tests/BlowfishCallbackConstraintTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/** | ||
* Password Validator. | ||
* | ||
* @link http://github.com/jeremykendall/password-validator Canonical source repo | ||
* | ||
* @copyright Copyright (c) 2014 Jeremy Kendall (http://about.me/jeremykendall) | ||
* @license http://github.com/jeremykendall/password-validator/blob/master/LICENSE MIT | ||
*/ | ||
|
||
namespace JeremyKendall\Password\Tests; | ||
|
||
trait BlowfishCallbackConstraintTrait | ||
{ | ||
/** | ||
* Gets callback constraint to validate blowfish encrypted password. | ||
* | ||
* @param string $cost Cost used in pattern. Must be 0 padded if less than 10 | ||
* | ||
* @return callable | ||
*/ | ||
public function getBlowfishCallback($cost = '10') | ||
{ | ||
$pattern = sprintf('/^\$2y\$%s\$.{53}$/', $cost); | ||
|
||
return function ($subject) use ($pattern) { | ||
return preg_match($pattern, $subject) === 1; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters