Reputation: 69
I've got a table of hashes and salts previously created by by another company. The hash was done in C# and the hash method is sha256. The logic behind this is sha256(password+salt)
.
An example of inputs:
password = 'rosnicka'
salt = 'zxwqTy+XjaY='
hash = '3jdt1+JL3MPmjYr2OoXdoUwNfuweuDCZa8/3g7SfsNg='
When I tried to run a hashing function in PHP
the output of this is
"1125ed47a7aa11bc1c54c841b5eb7a6e72aa8ad27e010e6e25baa5b2a86cffb3"
I get the same results using only hashing calculators
I contacted them to find out what I'm doing wrong. They told me, that are storing ASCII version of the hash in the database. What should I do in order to get the same hash in PHP or what to do in order to convert their hash to the original sha256 hash?
thanks a lot!
Upvotes: 1
Views: 629
Reputation: 223
As alex K said:
base64_encode(hash('sha256', 'rosnicka'.base64_decode('zxwqTy+XjaY='), true));
will do the trick
Upvotes: 2