创建MD5哈希在bash在Mac OS X
问题说明
你怎么能对使用庆典
A的MAC字符串创建MD5哈希? 的md5sum
并不在我的环境中。我做了一个人
为MD5,但我感到困惑的是什么确实做到了。
How can you create an md5 hash for a string on a mac using bash
? md5sum
does not exist in my environment. I did a man
for md5 but I'm confused about what that really does.
md5 "string"
不返回的哈希值。
does not return a hash.
正确答案
这应该工作 -
[jaypal:~/Temp] echo "this will be encrypted" | md5
72caf9daf910b5ef86796f74c20b7e0b
或者如果你preFER 这里字符串
标记然后 -
[jaypal:~/Temp] md5 <<< 'this will be encrypted'
72caf9daf910b5ef86796f74c20b7e0b
更新:
每人
页,您可以玩弄任何下列选项
UPDATE:
Per the man
page, you can play around with any of the following options
-s string
Print a checksum of the given string.
-p Echo stdin to stdout and append the checksum to stdout.
-q Quiet mode - only the checksum is printed out. Overrides the -r option.
[jaypal:~/Temp] md5 -s 'this will be encrypted'
MD5 ("this will be encrypted") = 502810f799de274ff7840a1549cd028a
[jaypal:~/Temp] md5 -qs 'this will be encrypted'
502810f799de274ff7840a1549cd028a
注意:MD5始终产生相同的哈希值。找到从上面给出的例子中的输出不同的原因是由于已经在评论已取得的点。前两个例子使用尾随换行
字符产生哈希值。为了避免这种情况,你可以使用:
Note: MD5 always produces the same hash. The reason you find the output different from the example given above is due to a point that has been made in the comments. The first two examples use the trailing newline
character to produce the hash. To avoid that, you can use:
[jaypal:~/Temp] echo -n "this will be encrypted" | md5
502810f799de274ff7840a1549cd028a
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfhaea
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20