I have been facing a problem in my Project. I want to generate a hash which is equivalent to node.js hash value.
Here is my Node.js code
And my PHP code is
$secret_key = hash('sha256', '', true); $contentHash = hash_hmac('sha256', '', $secret_key);
I want to generate same hash value though the platform is different.
You don’t want HMAC, you just want straight SHA256 in hex format:
$string = ''; $hash = hash('sha256', $string); echo $hash;
Answered By – Alex Howansky