当我尝试使用 openssl 对某个文件进行 SHA512 时,我得到的输出文件内容以“SHA512(in.txt)= 090c...”之类的内容开头
我使用命令尝试了不同的选项 -r, -binary
这是我正在使用的命令
openssl dgst -sha512 -out out.txt in.txt
问题是:如何获得仅包含哈希值而没有起始注释的文件?
awk如果文件名不包含空格,则只能使用 打印第二列:
openssl dgst -sha512 -out in.txt | awk '{print $2}' > out.txt
Run Code Online (Sandbox Code Playgroud)
或者(看起来不是跨平台的)您可以尝试使用管道或从标准输入读取:
openssl dgst -sha512 -out out.txt < in.txt
cat in.txt | openssl dgst -sha512 -out out.txt
Run Code Online (Sandbox Code Playgroud)
这对我有用(Mac OS X)。
| 归档时间: |
|
| 查看次数: |
3628 次 |
| 最近记录: |