dsq2015 2013-08-23 21:06
浏览 179
已采纳

例如,不同意相同字符串的md5哈希值

This is getting me crazy, my md5's don't agree. I have this string:

The Combinations Generator is a tool that allows you to easily create a series of combinations by selecting the related attributes. For example, if you're selling t-shirts in three different sizes and two different colors, the generator will create six combinations for you.

When I hash it on my computer using the md5 function (with php 5.5.0) it produces the following hash: 422f3f656e1a5f95e8b5cf7565d815b5

http://www.miraclesalad.com/webtools/md5.php agrees with my computer's result.

http://www.md5.cz/ disagrees with both my computer and miraclesalad.

This string/md5 pair was initially computed by another computer which also gives the same result as md5.cz.

I read about encoding issues (although the string doesn't contain any non ASCII characters), so I tried the following code on my computer:

<?php

$str = "The Combinations Generator is a tool that allows you to easily create a series of combinations by selecting the related attributes. For example, if you're selling t-shirts in three different sizes and two different colors, the generator will create six combinations for you.";

echo "$str<BR/>";
echo md5($str)."<BR/>";
echo md5(utf8_encode($str))."<BR/>";
echo md5(utf8_decode($str))."<BR/>";


die();

The output is:

The Combinations Generator is a tool that allows you to easily create a series of combinations by selecting the related attributes. For example, if you're selling t-shirts in three different sizes and two different colors, the generator will create six combinations for you.

422f3f656e1a5f95e8b5cf7565d815b5

422f3f656e1a5f95e8b5cf7565d815b5

422f3f656e1a5f95e8b5cf7565d815b5

So it is not about utf8.

Any idea what's happening?

  • 写回答

4条回答 默认 最新

  • drqvsx1228 2013-08-23 21:10
    关注

    My best guess is that it has something to do with the ' mark in the word "you're" and character encodings. If you remove that quote both sites report the same md5.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教