windows 直接从文件系统获取文件校验和,而不是显式计算

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7812258/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:17:23  来源:igfitidea点击:

Getting a file checksum directly from the filesystem instead of calculating it explicitly

windowsfilefilesystemschecksumntfs

提问by Branko Dimitrijevic

I'm guessing that a typical filesystem tends to keep some kind of checksum/CRC/hash of every file it manages, so it can detect file corruption.

我猜测典型的文件系统倾向于保留它管理的每个文件的某种校验和/CRC/哈希,因此它可以检测文件损坏。

Is that guess correct? And if yes, is there a way to access it?

这个猜测对吗?如果是,有没有办法访问它?

I'm primarily interested in Windows and NTFS, but comments on other platforms would be welcome as well... Language is unimportant at this point, but I'd like to avoid assembler if possible.

我主要对 Windows 和 NTFS 感兴趣,但也欢迎对其他平台的评论......此时语言并不重要,但我想尽可能避免使用汇编程序。

Thanks.

谢谢。

采纳答案by Branko Dimitrijevic

OK, it appears that what I'm asking is impossible.

好吧,看来我要问的是不可能的。

BTW, this was also discussed here: There is in Windows file systems a pre computed hash for each file?

顺便说一句,这也在这里讨论过:在 Windows 文件系统中,每个文件都有一个预先计算的散列?

回答by Thymine

In the majority of filesystems and the storage hardware they would keep checksums of allocation units, not full files.

在大多数文件系统和存储硬件中,他们会保留分配单元的校验和,而不是完整文件。

The checksums in the hardware are probably not accessible at all in general, and the checksum of the filesystem clusters would not be very useful for the great majority of cases so would be difficult to get, if possible.

一般来说,硬件中的校验和可能根本无法访问,并且文件系统集群的校验和在大多数情况下不是很有用,因此如果可能的话,很难获得。