验证SHA-256
openssl dgst -sha256 /path/to/file
验证SHA-1
openssl sha1 /path/to/file
验证 MD5
openssl md5 /path/to/file
备注
- MD5已经不再安全,推荐使用 SHA-256
- 最新的 macOS好像可以通过
md5 /path/to/file
的命令来验证MD5了,而sha256和sha1则没有这么直观的方式。不妨在 .bashrc / .zshrc 里加入一行alias sha256="openssl dgst -sha256"
来实现通过sha256 /path/to/file
校验 SHA256 - 文件路径不一定要手动打,可以拖拽文件到 terminal