验证文件摘要

发布于 2024-08-02 23:03:04 字数 337 浏览 2 评论 0原文

假设我有“n”个文件,每个文件都有 CRC32、MD5 和 SHA1 摘要,

现在这些“n”个文件实际上是单个大文件的分割文件/存档。

当这些较小的文件重新组合/加入到较大的文件中时,我们也可以计算这个较大文件的摘要。

我的问题是:有没有办法验证这些小文件的摘要组合是否等于大文件的摘要?

例如,假设我有一个文件分为 4 个部分,摘要为 0xDE、0xAD、0xBE、0xEF

假设加入后,较大的文件具有摘要 0xC0

有没有办法验证 join(0xDE, 0xAD, 0xBE, 0xEF) = = 0xC0,其中“join”是我正在寻找的神奇操作/公式/算法?

Say I have 'n' number of files, for each of which I have CRC32, MD5 and SHA1 digests

Now these 'n' number of files are actually split files/archives of single large file.

When these smaller files are recombined/joined into the larger file, we can compute the digest of this larger file too.

My question is : Is there a way to verify whether the combination of the digests of these smaller files equal the digest of the large file?

For example, say I have a file split into 4 parts with digests 0xDE, 0xAD, 0xBE, 0xEF

Say, after joining, the larger file has digest 0xC0

Is there any way to verify that join(0xDE, 0xAD, 0xBE, 0xEF) == 0xC0, where 'join' is the magical operation/formula/algorthm I am looking for?

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

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

发布评论

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

评论(2

就是爱搞怪 2024-08-09 23:03:04

别这么想,抱歉
如果可以

进行编辑,那么破解 MD5 将变得相当容易。如果你的意思是我可以根据各部分的 MD5 计算总和的 MD5 = 否。
但如果您只是想确认这些部分是否正确,您始终可以计算每个单独部分的 MD5,然后计算这些 MD5 集合的 MD5。
显然,要验证它,您需要执行相同的序列,因此只有完整文件的人必须将其拆分以进行相同的检查。

Don't think so, sorry
It would make it rather easy to crack an MD5 if this was possible

edit. If you mean can I compute the MD5 of the sum from the MD5 of the parts = no.
But if you just want to confirm that the parts are correct you can always calculate the MD5 of each individual part and then the MD5 of the set of those MD5s.
Obviously to verify it you need to perform the same sequence, so someone who only has the complete file would have to split it to do the same check.

一杆小烟枪 2024-08-09 23:03:04

如果你不想加入文件,你可以使用 TransformBlock 方法将它们一一传递给哈希算法。通过调用 TransformFinalBlock 可以得到结果。

If you won't to join the files, you can pass them one by one to hash algorithm using TransformBlock method. With calling TransformFinalBlock that gives you the result.

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