在下载文件时通常会需要对哈希值进行校验
在传输大文件前后也要进行哈希校验,确保文件传输过程没有损坏
在下载一些常用的软件时,官网通常会提供哈希值校验,通过校验哈希值也能避免下载恶意文件
1、fciv.exe下载地址
https://www.microsoft.com/en-us/download/details.aspx?id=11533
2、尽管win10已经可以利用powershell来计算文件的哈希值,但这款微软提供的软件使用范围更广
3、使用说明
Usage: fciv.exe [Commands] <Options>
Commands: ( Default -add )
-add <file | dir> : Compute hash and send to output (default screen).
dir options:
-r : recursive.
-type : ex: -type *.exe.
-exc file: list of directories that should not be computed.
-wp : Without full path name. ( Default store full path)
-bp : specify base path to remove from full path name
-list : List entries in the database.
-v : Verify hashes.
: Option: -bp basepath.
-? -h -help : Extended Help.
Options:
-md5 | -sha1 | -both : Specify hashtype, default md5.
-xml db : Specify database format and name.
To display the MD5 hash of a file, type fciv.exe filename
Compute hashes:
fciv.exe c:\mydir\myfile.dll
fciv.exe c:\ -r -exc exceptions.txt -sha1 -xml dbsha.xml
fciv.exe c:\mydir -type *.exe
fciv.exe c:\mydir -wp -both -xml db.xml
List hashes stored in database:
fciv.exe -list -sha1 -xml db.xml
Verifications:
fciv.exe -v -sha1 -xml db.xml
fciv.exe -v -bp c:\mydir -sha1 -xml db.xml
示例:
计算哈希值: .\fciv.exe D:\test\11.txt -sha1 -xml 11.xml
校验哈希值:.\fciv.exe -v D:\test\11.txt -sha1 -xml 11.xml
计算某目录下全部文件哈希值
.\fciv.exe D:\test\ -sha1 -xml test.xml
计算某目录下全部文件md5值
.\fciv.exe D:\test\ -md5 -xml test.xml
计算某目录下全部文件md5值和哈希值
.\fciv.exe D:\test\ -both -xml test.xml
11.txt的md5及哈希值的生成的xml文件内容,md5及哈希值做了再次加密,不太明白为什么还要再次做加密
直接计算11.txt文件的md5及哈希值