python 代码:
import hashlib
h = hashlib.md5('helloworld')
print h.hexdigest()
---
输出:fc5e038d38a57032085441e7fe7010b0
shell 代码:
$> echo helloworld | md5
---
输出:d73b04b0e696b0945283defa3eee4538
echo默认会在字符串后面加上"\n",可以用-n选项,如下:
➜ ~ echo -n helloworld | md5
fc5e038d38a57032085441e7fe7010b0