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条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度