我在linux命令行下获取md5sum是这样子:linux
echo 123456 | md5sum
但这样跟编程语言相比,有很大不一样。由于echo会自动在行尾追加"\n"符号,我之前写博文也讨论过这个问题。shell
应该这样作:编程
echo -n 123456 | md5sum
参考 :ubuntu
How to get the MD5 hash of a string directly in the terminal?编程语言