dongzhang2150 2010-12-16 19:39
浏览 125
已采纳

一个字符串的md5哈希值可以在另一个地方不同吗? [重复]

Possible Duplicate:
Will the MD5 cryptographic hash function output be same in all programming languages?

Hi,

I have a problem about md5 hashing. Users can upload profile picures on my project. I am md5 hashing usernames for profile picture name. But there is something interesting. I am hashing a value both with a test page on my server and md5 encrypt websites with same result. When I use this encryption for renaming image, it produces something different. It produces different value on image manipulation file.

Do you have any idea?

This is my check script:

<?php echo md5('funky'); ?>

It produces below code on my server and also on md5encrypter.com :

6b818a3a6bf1234ed24c940021922b63

But it produces on my image manipulation file below code. I dont know what it is:

d41d8cd98f00b204e9800998ecf8427e

Script for sql query. $userId comes from logged in userId:

$sql = mysql_query("SELECT username FROM users WHERE userId='$userId'");
while($row=mysql_fetch_assoc($sql)){
  $username=$row['username'];
}
  • 写回答

2条回答 默认 最新

  • dongyihao1099 2010-12-16 20:02
    关注

    d41d8cd98f00b204e9800998ecf8427e is the MD5 hash of an empty string, so somewhere you have failed to fill your string with something more useful...

    MD5 will always produce the same output for a given input, otherwise it's not MD5. What I did was simply google for the hash you got, and it turned up a lot of hits. If I didn't get a hit, I would have searched some of the reverse MD5 dictionaries which are around to see if that gave some clues.

    As luck would have it, your hash is simply the result of MD5(''), is very common. It clearly indicates you tried to obtain something from your DB, failed, and hashed it anyway.

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

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器