echo -n 'yourstring' | openssl dgst -md5
MD5(stdin)= 5d7aed02367214a092f9eefed33f86d7
SELECT MD5('yourstring');
0653fc45290cd602be895bb8d054942c
echo -n 'yourdata' | openssl dgst -sha256
SHA2-256(stdin)= 3155c1e53ebf714c6a3a074b3d0547cb8d0d92b0781a2b539a9953cc06e0440c
SELECT SHA2('yourdata', 256);
877d0019ddf00063e6677738ced44f5972e2d9f667121a20c390c84e020d2e10
SELECT @@character_set_database, @@collation_database, version();
'utf8mb4', 'utf8mb4_0900_ai_ci', '8.4.2'
I expected both hashes to be the same. Tried different variation of converting to HEX and CAST(string AS BINARY) etc. Tried echo with and without -n and with single and double quotes. The hashes are always different.