I get different results when trying to generate a hash using bash commands and the hash function () of PHP. I reviewed the previous questions, and the most common problem is that there is a new line or some other character in the line, however, I perform functions on real lines, not on files, so this is not a problem.
For instance:
Bash:
md5sum <<< hello: b1946ac92492d2347c6235b4d2611184
sha256sum <<< hello: 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03
PHP hash () function:
hash('md5', 'hello'): 9dd4e461268c8034f5c8564e155c67a6
hash('sha256', 'hello'): 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
What am I missing here? Why are the meanings different?
source
share