exe校验和不同,每次重新编译后 [英] exe checksum different after each recompile

查看:408
本文介绍了exe校验和不同,每次重新编译后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图找出如何让我的exe有相同的哈希码/校验和重新编译时。我使用FastSum来生成校验和。目前,没有代码更改,我只是重建项目在VS和校验和出来不同。代码是用c ++编写的。

So I'm trying to figure out how to get my exe to have the same hash code/checksum when it's recompiled. I'm using FastSum to generate the checksum. Currently, no code changes are made, I'm just rebuilding the project in VS and the checksum comes out different. The code is written in c++.

我不熟悉以这种方式使用哈希码和/或校验和,但是我做了一些研究,一致GUID。但我不知道如何结合校验和生成程序...

I'm not familiar with using hash codes and/or checksums in this manner, but I did some research and read something about needing a consistent GUID. But I have no idea how that would tie into the checksum generation program...

好吧,我会离开它,提前感谢。

Well, I'll leave it at that, thanks in advance.

推荐答案

你检查过exes之间的区别吗?我怀疑编译器/链接器将日期或时间插入二进制,因此每个二进制将不同于另一个。或者它可能更糟,有时编译器/链接器在自己的系统内存中构建静态表,然后将其复制到二进制,说你有9个字节的东西和对齐的原因,编译器选择使用12个字节的二进制,我见过编译器/链接器接受该计算机的系统内存中的任何3个字节,并将其复制到文件中。理想情况下,您希望工具清除它们用于此类事件的内存,以便您获得可重复的结果。

Have you examined the differences between the exes? I suspect the compiler/linker is inserting the date or time into the binary and as a result each binary will be different from another. Or it could be worse, sometimes compilers/linkers build static tables in their own system memory then copy that into the binary, say you have 9 bytes of something and for alignment reasons the compiler chooses to use 12 bytes in the binary, I have seen compilers/linkers take whatever 3 bytes are in system memory of that computer and copy that into the file. Ideally you would want the tools to zero out memory they are using for such a thing so you get repeatable results.

基本上在文件之间做一个二进制差异,了解为什么他们不匹配。

Basically do a binary diff between the files you should then find out why they dont match.

这篇关于exe校验和不同,每次重新编译后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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