Windows 相當於「sha256sum -c」(加密雜湊、摘要檔、遞歸完整性檢查、SHA256SUMS)

Windows 相當於「sha256sum -c」(加密雜湊、摘要檔、遞歸完整性檢查、SHA256SUMS)

相當於sha256sum -cWindows 中的什麼?

我有一組非常重要的文件,需要在許多不同地理位置的許多不同類型的磁碟上複製和鏡像。透過 USB、乙太網路、光纖、無線電、電報和訊號火(其中一些是比其他傳輸方式更可靠的傳輸方式!)將內容中繼到磁碟後,我想檢查寫入磁碟的資料的完整性。

在 Debian Linux 中,檔案校驗和通常儲存在SHA256SUM使用命令產生的「摘要」檔案中sha256sum。使用此命令產生此檔案非常簡單,其中包含目前目錄和子目錄中所有檔案的遞歸 SHA256 校驗和。對於使用者來說,使用此命令遞歸地驗證所有檔案的完整性也非常簡單。例如,考慮這個貓圖片的超臨界資料集

user@disp3274:~/Pictures$ tree
.
├── cats
│   ├── cat1.jpeg
│   ├── cat2.jpeg
│   └── cat3.jpeg
└── people
    ├── person1.jpeg
    └── person2.jpeg

2 directories, 5 files
user@disp3274:~/Pictures$ 

我可以如下產生校驗和文件

user@disp3274:~/Pictures$ time sha256sum `find . -type f` > SHA256SUMS

real    0m0.010s
user    0m0.008s
sys 0m0.002s
user@disp3274:~/Pictures$

user@disp3274:~/Pictures$ cat SHA256SUMS 
b2d82e7b8dcbaef4d06466bee3486c12467ce5882e2eabe735319a90606f206a  ./people/person2.jpeg
e01f7b240f300ce629c07502639a670d9665e82df6cba9311b87ba3ad23c595d  ./people/person1.jpeg
53e056cc91fd4157880fb746255a2f621ebee8ca6351a659130d6228142c1e47  ./cats/cat1.jpeg
a0a73a21b9d26f1bbe4fcfce0acd21964dedf2dc247a5fe99bd9f304aa137379  ./cats/cat2.jpeg
a171fa88d431a531960b6eb312d964ed66cc35afd64bde5dda9b929ad83343f6  ./cats/cat3.jpeg
user@disp3274:~/Pictures$ 

我可以驗證所有文件的完整性,如下所示

user@disp3274:~/Pictures$ time sha256sum -c SHA256SUMS 
./people/person2.jpeg: OK
./people/person1.jpeg: OK
./cats/cat1.jpeg: OK
./cats/cat2.jpeg: OK
./cats/cat3.jpeg: OK

real    0m0.009s
user    0m0.008s
sys 0m0.000s
user@disp3274:~/Pictures$ 

SHA256SUMS在 Windows 中,用於遞歸生成(或使用另一個加密雜湊函數的類似摘要文件)並驗證一組文件的完整性的等效內建工具是什麼?

答案1

New-FileCatalog 和 Test-FileCatalog 可以做到這一點。

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/new-filecatalog?view=powershell-7.2

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/test-filecatalog?view=powershell-7.2

New-FileCatalog -Path "x:\DirectoryName" -CatalogFilePath "x:\SomeOtherDirectoryName\"


Test-FileCatalog -Path "x:\DirectoryName" -CatalogFilePath "x:\SomeOtherDirectoryName\catalog.cat"

答案2

我用的是fsum。 https://www.slavasoft.com/fsum/ 速度更快,但存在不同代碼頁的問題。

另一位是exf https://www.exactfile.com/exf/ 速度較慢,但可以理解代碼頁。

相關內容