2017 © Pedro Peláez
 

library pbkdf2

An implementation of PBKDF2 invented by RSA Laboratories. Useful for password strengthening.

image

security/pbkdf2

An implementation of PBKDF2 invented by RSA Laboratories. Useful for password strengthening.

  • Friday, August 24, 2012
  • by thesmart
  • Repository
  • 0 Watchers
  • 1 Stars
  • 59 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 3 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

php-PBKDF2

An implementation of PBKDF2 invented by RSA Laboratories. Useful for password stretching / strengthening., (*1)

The technique is useful for making user passwords and keys much tougher to reverse. This is very valuable for preventing high profile and embarrassing releases of user passwords., (*2)

For more detailed information, please visit the geniuses at RSA Labs: http://www.ietf.org/rfc/rfc2898.txt., (*3)

Usage

Usage of this library is very simple., (*4)

Strengthen a new password

$pass = $_POST['user_created_password'];
$salt = Pbkdf2::generateRandomSalt();
$passHash = Pbkdf2::hash($pass, $salt);
unset($pass);
// store $passHash and $salt in the database

Test a password for match

// get $passHash and $salt from the database
$isMatch = Pbkdf2::isMatch($_POST['user_password'], $passHash, $salt);
if ($isMatch) {
    // grant login attempt
} else {
    // reject login attempt
}

Additional Security

You can also pass an optional arguments for additional security, with a trade-off of performance., (*5)

define('CRAZY_LONG_HASH', 'p,gx>vrQ<ayWY9hCd8YZ3KJGNsczWddv?)rMCLVujcPX/=BGVE');
define('CRAZY_HASH_ITERATIONS', 100000);

$pass = $_POST['user_created_password'];
$salt = Pbkdf2::generateRandomSalt();
$passHash = Pbkdf2::hash($pass, $salt, CRAZY_HASH_ITERATIONS, CRAZY_LONG_HASH);
unset($pass);
// store $passHash and $salt in the database

Make sure you use the same number of iterations, (*6)

// get $passHash and $salt from the database
$isMatch = Pbkdf2::isMatch($_POST['user_password'], $passHash, $salt, CRAZY_HASH_ITERATIONS);
if ($isMatch) {
    // grant login attempt
} else {
    // reject login attempt
}

The Versions

24/08 2012

dev-master

9999999-dev https://github.com/thesmart/php-PBKDF2

An implementation of PBKDF2 invented by RSA Laboratories. Useful for password strengthening.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

password rsa hash pbkdf2 salt

24/08 2012

v0.1.1

0.1.1.0 https://github.com/thesmart/php-PBKDF2

An implementation of PBKDF2 invented by RSA Laboratories. Useful for password strengthening.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

password rsa hash pbkdf2 salt

24/08 2012

v0.1.0

0.1.0.0 https://github.com/thesmart/php-stache

An implementation of PBKDF2 invented by RSA Laboratories. Useful for password strengthening.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mongodb pairs memached