.exe 文件的哈希值

发布于 2024-08-04 22:32:50 字数 114 浏览 2 评论 0原文

我想知道在运行该文件之前、之后或之后在 .exe 文件上生成校验和时是否会得到不同的结果。我更关心常见实践(例如生成 firefox.exe 等流行应用程序的 SHA 哈希值)而不是边界情况,但两者都很有趣。谢谢。

I'm wondering whether I will ever get a different result when producing a checksum on an .exe file before and then while or after running that file. I'm more concerned with common practice (such as producing a SHA hash of popular app like firefox.exe) than with boundary cases, but both are interesting. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

枕头说它不想醒 2024-08-11 22:32:50

只要文件相同(即仅包含相同的字节、相同的顺序),文件的哈希值就应该保持不变。很少有应用程序在运行时重写其在磁盘上的表示形式,因此哈希应该是恒定的。有一些自修改程序,但它们倾向于在内存中加载的代码副本上进行操作,而不是在磁盘副本上进行操作。

编辑:我们应该考虑“自我更新”应用程序,但这些应用程序往往会启动一个小帮助程序来下载和更新核心应用程序。在运行时更新执行是很困难的(尤其是在 Windows 上)。 UNIX 系统倾向于运行 Copy on Write 系统,因此软件更新可能会更改您脚下的可执行文件 - 但同样,这是一个“极端情况”。

The hash of a file should be constant for as long as the file is identical (i.e. contains only the same bytes, in the same order). It's very rare to find applications that rewrite their on-disk representation at runtime, so the hash should be constant. There are self-modifying programs, but they tend to operate on the in-memory loaded copy of their code, rather than the disk copy.

Edit: We should consider "Self-updating" applications, but these tend to launch a little helper program to download and update the core application. It's difficult (especially on Windows) to update an execution whilst it's running. UNIX systems tend to operate Copy on Write systems, so it's possible that a software update might change your executable under your feet - but again, this is a "corner case".

っ左 2024-08-11 22:32:50

仅当 exe 更改时,哈希值才会更改。只有应用程序自行修改时才会发生这种情况,而在不重新启动应用程序的情况下,这种情况在 Windows 上不会发生。 Firefox 可能会自行更新(包括重新启动),但除此之外,哈希值将保持不变。

The hash will only change if the exe changes. That will only happen if the app modifies itself, which isn't going to happen on windows without the app restarting. Firefox might update itself (including a restart), but apart from such cases, the hash will remain the same.

远昼 2024-08-11 22:32:50

如果文件更改,哈希值也会更改。

EXE 文件很少自行更改。如果用户更新到新版本,firefox.exe 将会发生变化。

您可以在运行 EXE 文件(例如 firefox.exe)后检查它的“修改日期”属性,看看它是否已更改,但您可能会发现它没有更改。

The hash will change if the file changes.

EXE files rarely change on their own. firefox.exe would change if the user updates to a new version.

You can check the "date modified" attribute of an EXE file (like firefox.exe) after running it to see whether it has changed, but you'll probably find it hasn't.

葬シ愛 2024-08-11 22:32:50

如果您指的是修改上次访问时间,请不用担心,它存储在文件系统级别,而不是存储在文件内,因此哈希将保持不变。

If you mean the modification of the last access time, don't worry, it's stored at the filesystem level, not within the file so the hash will remain the same.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文