eloquent / pbkdf2-compat
A compatibility library for the PHP 5.5 function hash_pbkdf2().
Installs: 143 042
Dependents: 3
Suggesters: 0
Security: 0
Stars: 14
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.3
Requires (Dev)
- icecave/archer: ~1
This package is auto-updated.
Last update: 2020-02-06 04:54:35 UTC
README
A compatibility library for the PHP 5.5 function hash_pbkdf2().
Installation and documentation
- Available as Composer package eloquent/pbkdf2-compat.
What does it do?
This library provides a forwards-compatible implementation of the hash_pbkdf2() function introduced in PHP 5.5. It allows the use of this function in versions of PHP prior to 5.5, and falls back to the native function when it is available.
Usage
See the PHP manual entry.
Behaviour of length parameter
Although the documentation does not specify, the $length parameter refers to the resulting string length, not the length of the raw hash. This means that when $raw_output is false, $length needs to be doubled to produce a hash containing the same amount of data (because hex encoding doubles the number of bytes in the result string).
Acknowledgements
Inspired by ircmaxell/password_compat. PBKDF2 implementation derived from Symfony's Pbkdf2PasswordEncoder.