WinCmd/fciv

ファイルのハッシュ値の計算と確認

FCIV (File Checksum Integrity Verifier) utility.

FCIV は、マイクロソフトが提供するファイルの暗号ハッシュを計算するコマンドラインユーティリティ。

サポートされるハッシュアルゴリズムは、MD5 と SHA1 。ハッシュ値は、コンソールに出力 もしくは、XML形式のファイルに出力される。実行ファイルは、サポートページから Windows-KB841290-x86-ENU.exe というファイルが入手出来る。

コマンドライン

//
// File Checksum Integrity Verifier version 2.05.
//

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

簡単な使い方

 ハッシュ値を求める

MD5(-md5) か SHA1(-sha1) か 両方(-both) かを指定して、ファイルを指定する。

C:\>fciv -sha1 C:\Windows\System32\cmd.exe
//
// File Checksum Integrity Verifier version 2.05.
//
f5cfd4070ea7d2b40a29f21f9e29af23341c59ec c:\windows\system32\cmd.exe

 XML DB に保存し比較をする

「-xml」で保存するXMLファイル名を指定する。

C:\>fciv -sha1 C:\Windows\System32\cmd.exe -xml sha1.xml
//
// File Checksum Integrity Verifier version 2.05.
//

「-list」オプションで XML DB の内容を表示する。指定したハッシュアルゴリズムが表示される。

C:\>fciv -list -sha1 -xml sha1.xml
//
// File Checksum Integrity Verifier version 2.05.
//
Listing entries in database:
----------------------------

                SHA1                            Filename
-------------------------------------------------------------------------
f5cfd4070ea7d2b40a29f21f9e29af23341c59ec c:\windows\system32\cmd.exe

Number of entries found: 1

「-v」オプションで XML DB の内容を比較する。

C:\>fciv -v -xml sha1.xml
//
// File Checksum Integrity Verifier version 2.05.
//
Could not create the registry key.
Starting checksums verification : 09/03/2014 at 19h11'57

All files verified successfully

End Verification : 09/03/2014 at 19h11'57

XML DB は以下のように保存される。

C:\>type sha1.xml
<?xml version="1.0" encoding="utf-8"?>
<FCIV>
  <FILE_ENTRY><name>c:\windows\system32\cmd.exe</name><SHA1>9c/UBw6n0rQKKfIfnimvIzQcWew=</SHA1></FILE_ENTRY></FCIV>

 UNIX の md5sum, sha1sum の出力形式に似せる

FCIV はそのまま出力すると先頭3行にFCIVのロゴが出力される。ので、FORコマンドを利用し先頭3行をスキップして出力する。

for /F "skip=3 delims=" %s in ('fciv -md5 C:\temp') do @echo %s>>md5.txt

最終更新時間:2014年09月03日 19時40分22秒 指摘や意見などあればSandBoxのBBSへ。

ようこそ、ゲスト さん

メニュー

検索

キーワード

最新

2016/4/19

2016/4/15

2016/3/25

2016/3/7

2016/2/16

Copyright (C) 2002-2010 たけ
Powered by FreeStyleWiki3.6.4 with Perl5.016003
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%