MD5 算法是否总是为相同的字符串生成相同的输出?
MD5 算法是否总是为相同的字符串生成相同的输出?
使用盐是产生不同输出的唯一方法吗?
Does the MD5 algorithm always generate the same output for the same string?
Is using a salt the only to produce different output?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
是的,否则 MD5 对于文件验证之类的事情就没用了。您对非确定性输出有什么理由?
Yes, otherwise MD5 would be useless for things like file verification. What reason would you have for non deterministic output?
是的,对于相同的输入,MD5 总是输出相同的结果。这就是它用于密码的方式。您将哈希存储在数据库中,然后当用户输入密码时,它会再次进行哈希处理并比较两个哈希值。
注意:不建议使用 MD5 对密码进行哈希处理,因为它的加密能力较弱。有更合适的加密哈希可用,例如 bcrypt。然而,从历史上看,它曾被用于此目的。
Yes, MD5 always outputs the same given the same input. That's how it's used for passwords. You store the hash in the database, then when the user types their password in, it's hashed again and the two hashes are compared.
NOTE: MD5 is not recommended for hashing passwords because it's cryptographically weak. There are more suitable cryptographic hashes available, such as bcrypt. However, historically, it has been used for this purpose.
是的,哈希算法总是产生相同的输出。如果您使用相同的盐,对于给定的输入也将始终产生相同的输出。
Yes, a hash algorithm always produces the same output. If you use the same salt, this will also always produce the same output for a given input.
是的。 MD5是一种哈希函数。
这并不意味着 MD5 是唯一的。多个输入可以映射到相同的哈希值,但任何给定的输入都只有一个哈希值。
Yes. MD5 is a hash function.
This does not mean that an MD5 is unique. Multiple inputs could map to the same hash, but any given input has only one hash.
是的,MD5 是确定性的,这被认为是许多消息摘要函数应用程序所希望的特性。
至于使用盐,你真正的意思是“以某种微妙的方式改变输入字符串”,不是吗?当然,消息摘要的一个理想特征是它们为不同的消息生成(以非常高的概率)不同的摘要。
Yes MD5 is deterministic, and this is considered a desirable characteristic for many applications of message digest functions.
As for using a salt, by that you really mean 'changing the input string in some subtle way' don't you ? And, of course, it is also a desirable characteristic of message digests that they produce (with very high probability) a different digest for a different message.
是的。尽管在某些情况下它会为不同的字符串创建相同的哈希值。
Yes. Although in some cases it creates the same hash for different strings.