不使用MD5在线生成工具,很多软件自身有这个功能
mysql
select md5('hello');
5d41402abc4b2a76b9719d911017c592
shell
echo -n "hello" | md5sum
5d41402abc4b2a76b9719d911017c592 -
echo -n "hello" | openssl dgst -md5
MD5(stdin)= 5d41402abc4b2a76b9719d911017c592
oracle
SELECT DBMS_OBFUSCATION_TOOLKIT.MD5 (input =>UTL_RAW.CAST_TO_RAW ('hello')) HASH_KEY FROM dual;
5D41402ABC4B2A76B9719D911017C592
如果字符串包含汉字,要考虑编码问题:
select md5('今天hello');
930990d91a73d76590288a60dc797e18
select md5(CONVERT('今天hello' using gbk)) as md5_out;
97ffcf4ef5d5092976d31c0d1366ef74
echo -n "今天hello" | openssl dgst -md5
MD5(stdin)= 930990d91a73d76590288a60dc797e18
shell GBK 编码
echo -n "今天hello" | openssl dgst -md5
MD5(stdin)= 97ffcf4ef5d5092976d31c0d1366ef74
echo -n "今天hello" | md5sum
930990d91a73d76590288a60dc797e18 -
shell GBK 编码
echo -n "今天hello" | md5sum
97ffcf4ef5d5092976d31c0d1366ef74 -
SELECT DBMS_OBFUSCATION_TOOLKIT.MD5 (input =>UTL_RAW.CAST_TO_RAW ('今天hello')) HASH_KEY FROM dual;
97FFCF4EF5D5092976D31C0D1366EF74
在我的机器上Oracle默认使用GBK