Zip 文件包含相同的文件但具有不同的哈希值? [英] Zip files contain same files but have different hashes?

查看:60
本文介绍了Zip 文件包含相同的文件但具有不同的哈希值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 php 创建了数百个文件夹和文本文件,然后将它们添加到 zip 存档中.

I have created hundreds of folders and text files using php, I then add them to a zip archive.

这一切正常,但如果我使用相同的文件夹和文件创建另一个 zip 存档,新存档将具有与第一个不同的哈希值.如果我使用 winrar 而不是 php 来创建存档,这也是一样的.

This all works fine but if I create another zip archive using the same folders and files, the new archive will have a different hash to the first one. This is the same if I use winrar instead of php to create an archive.

当我压缩通过 php 创建的文件时,它似乎只显示不同的哈希值,但它们打开得很好.

It only seems to show different hashes when I zip the files I have created through php, yet they open fine.

很奇怪有人对此有所了解吗?

Very strange anyone shed any light on this?

谢谢

推荐答案

文件肯定有一些不同.如果长度不完全相同,哈希值就会不同.您可以使用比较十六进制编辑器(例如 Hex Workshop)来查看究竟有何不同.

There is certainly some difference in the files. If the lengths are not exactly the same, the hash will be different. You can use a comparing hex editor, like Hex Workshop for example, to see what exactly the differences are.

我想到的可能性:

  1. 正如@orn 所提到的,您使用的 zip 格式可能有时间戳(不确定).
  2. 将文件添加到存档的顺序可能不同(取决于您如何选择它们/构建源数组).

这篇关于Zip 文件包含相同的文件但具有不同的哈希值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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