Skip to content

Instantly share code, notes, and snippets.

@hparadiz
Created September 24, 2012 14:42
Show Gist options
  • Save hparadiz/3776284 to your computer and use it in GitHub Desktop.
Save hparadiz/3776284 to your computer and use it in GitHub Desktop.
PHP Version of devise/lib/devise/encryptors/restful_authentication_sha1.rb for Older Versions of Devise
define('_DIGEST_PEPPER','PEPPER HERE');
function digest($password, $stretches, $salt, $pepper)
{
$digest = $pepper;
$x = 0;
while($x != $stretches)
{
$data = array($digest,$salt,$password,$pepper);
$digest = sha1(implode('--',$data));
$x++;
}
return $digest;
}
digest($pass,10,$password_salt,_DIGEST_PEPPER);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment