diff options
| author | Marc Alexander <admin@m-a-styles.de> | 2013-06-27 14:20:47 +0200 |
|---|---|---|
| committer | Marc Alexander <admin@m-a-styles.de> | 2013-09-14 13:53:19 +0200 |
| commit | 857b90057b6b613c844b0358340f452cd8174df5 (patch) | |
| tree | d6bbed6e475b44f5ade38a4a27ddab2421786e0a /phpBB/includes/crypto/driver/bcrypt.php | |
| parent | dae4327cfcd0908dc751f47cbbc462df454d153c (diff) | |
| download | forums-857b90057b6b613c844b0358340f452cd8174df5.tar forums-857b90057b6b613c844b0358340f452cd8174df5.tar.gz forums-857b90057b6b613c844b0358340f452cd8174df5.tar.bz2 forums-857b90057b6b613c844b0358340f452cd8174df5.tar.xz forums-857b90057b6b613c844b0358340f452cd8174df5.zip | |
[feature/passwords] Add method for obtaining the hash settings only
This is needed for combined hashing of passwords.
PHPBB3-11610
Diffstat (limited to 'phpBB/includes/crypto/driver/bcrypt.php')
| -rw-r--r-- | phpBB/includes/crypto/driver/bcrypt.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/phpBB/includes/crypto/driver/bcrypt.php b/phpBB/includes/crypto/driver/bcrypt.php index c6334d1779..ad5a8036c3 100644 --- a/phpBB/includes/crypto/driver/bcrypt.php +++ b/phpBB/includes/crypto/driver/bcrypt.php @@ -87,4 +87,22 @@ class phpbb_crypto_driver_bcrypt extends phpbb_crypto_driver_base { return $this->helper->hash_encode64($this->helper->get_random_salt(22), 22); } + + /** + * @inheritdoc + */ + public function get_settings_only($hash, $full = false) + { + if ($full) + { + $pos = stripos($hash, '$', 1) + 1; + $length = 22 + (strripos($hash, '$') + 1 - $pos); + } + else + { + $pos = strripos($hash, '$') + 1; + $length = 22; + } + return substr($hash, $pos, $length); + } } |
