MD5哈希计算不同的服务器上 [英] MD5 hash calculates differently on server

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

问题描述

我跑,我已经写在C这就要求从哈希库别人写的MD5哈希功能的一些code(md5.c&安培; md5.h)。奇怪的行为,我一直看到的是:

I am running some code that I have written in C which calls the md5 hashing functionality from a hashing library that someone else wrote (md5.c & md5.h). The odd behavior I have been seeing is:

散列完美的工作= 1散列一个字符串,它出来到我已经验证它是与多个其他来源的确切哈希值。

hashing working perfectly = I hash a string, and it comes out to the exact hash that I have verified it to be with multiple other sources.


  1. 散列功能的作品
    完美的编译和运行时
    我的OSX机器和散列上
    计算是完全理所应当
    可以。

  1. Hashing functionality works perfectly when compiling and running on my OSX machine and the hash that is computed is exactly as it should be.

同一code,无变化上传
并编制在基于Linux的
服务器和它计算一个不同的
(错误)的哈希值。

Same code, no changes is uploaded and compiled on the Linux based server and it computes a different (wrong) hash.

有没有人对如何准确,这将是可能的任何见解?它已经在过去的一周疯狂驾驶,我不明白这是为什么甚至有可能。我也测试了它另一台机器上,编译和执行,它完美的作品。它只是当我把它上传到了哈希不再正确的服务器。

Does anyone have any insight on how exactly this would be possible? Its been driving crazy for the past week and I do not understand why this is even possible. I have also tested it on another machine, compiled and executed and it works perfectly. Its just when I upload it to the server that the hash is no longer correct.

散列功能的文件可以发现:
http://people.csail.mit.edu/rivest/Md5.c

The hashing functionality file can be found at: http://people.csail.mit.edu/rivest/Md5.c

解决:谢谢大家
它是64位的拱问题。其强大的烦人,那我忘了考虑调试时.......

SOLVED: Thanks everyone It was the 64-bit arch issue. Its mighty annoying that that slipped my mind to consider that when debugging.......

推荐答案

尝试更换(Md5.c 41行)

Try to replace (Md5.c line 41)

的typedef unsigned long int类型UINT4;

的typedef uint32_t的UINT4;

(包括如果需要stdint.h)

(include stdint.h if needed)

在64位机器长整型(通常)64位长,而不是32

On a 64 bits machine long int are (usually) 64 bits long instead of 32

修改

我想在64位的Opteron这解决了问题。

I tried on a 64 bits opteron this solves the problem.

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

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