I find myself in a need to change website platforms from Java to PHP but I\'d like to keep all my user\'s passwords...
I had this code do the password hashing prior
PHP's sha1() encodes each byte of the output as hexadecimal by default, but you can get the raw output by passing true
as the second argument:
$digest = sha1($password, true); // This returns the same string of bytes as md.digest()
Then pass the digest to base64_encode and you are done:
base64_encode(sha1($password, true));
This returns the exact same SHA-1 hash as your java code.