具有不同结果的MD5哈希 [英] MD5 hash with different results

查看:71
本文介绍了具有不同结果的MD5哈希的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编码一些链到MD5,但我注意到:



对于链:123456çñ



有些网站喜欢

http://www.md5 .net



md5generator.net



返回:66f561bb6b68372213dd9768e55e1002



和其他人一样:

http://www.adamek.biz/md5-generator.php



7thspace.com/webmaster_tools/online_md5_encoder.html

md5.rednoize.com /



return:9e6c9a1eeb5e00fbf4a2cd6519e0cfcb



我需要使用标准md5对链进行编码,因为我需要将结果与其他系统连接起来。哪些散列是正确的?



在此先感谢

解决方案

问题我猜是用不同的文本编码。您显示的字符串不能用ANSI编码表示 - 它需要UTF-16或UTF-8。后者之一的选择导致字符串的不同字节表示,并产生不同的散列。



记住,MD5散列字节,而不是字符 - 它取决于你在将字节送入MD5之前将这些字符编码为字节。如果您想与其他系统进行互操作,您必须使用与这些系统相同的编码。


Im trying to encode some chains to MD5 but I have noticed that:

For the chain: "123456çñ"

Some webs like

http://www.md5.net

www.md5.cz

md5generator.net

return: "66f561bb6b68372213dd9768e55e1002"

And others like:

http://www.adamek.biz/md5-generator.php

7thspace.com/webmaster_tools/online_md5_encoder.html

md5.rednoize.com/

return: "9e6c9a1eeb5e00fbf4a2cd6519e0cfcb"

I'd need to encode the chains with standar md5 because I need to connect my results with other systems. which hash is the correct?

Thanks in advance

解决方案

The problem I guess is in different text encodings. The string you show can't be represented in ANSI encoding - it requires UTF-16 or UTF-8. The choice of one of the latter leads to different byte representation of the string and that produces different hashes.

Remember, MD5 hashes bytes, not characters - it's up to you how to encode those characters as bytes before feeding bytes to MD5. If you want to interoperate with other systems you have to use the same encoding as those systems.

这篇关于具有不同结果的MD5哈希的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆