A tool for getting a complete directory/file listing with detailed information including hash(es)

directory-listinghashing

Once in a while, I take a complete snapshot of my drives with a command like the following.

> for %i in (%drives_hd%) do @dir %i:\/s/a/o>>File_List.txt

This gives detailed information (path, filename, date, and size) for all files on my system and is great for keeping tabs on the files without expending too much space (~50MB for ~500,000 files). The problem is that it does not contain hashes.

Obviously there are file-hashing tools, but they don’t give the other details, and there is no practical way to do the hash(es) separately and combine it/them with the directory listings.

I’m looking for a tool that can create a text file with complete details like with the dir command, but also include file hashes (at least CRC(32), MD5, and SHA1). It should also be well written though so that it only reads each file once no matter how many hashes you ask it to do (ie., don’t read the whole file once for each hash type).

I’d prefer a CLI program, but a GUI one is okay, so long as it can be run from a script.

I’m even open to (Windows ports of) Linux tools.

I could find nothing with Google (though I am surprised such a useful tool is not more common), and have considered writing such a tool myself, but I’m hoping something already exists.


To make clear what I am looking for, see the below sample outputs.

Default dir output:

 Volume in drive C is C-WINDOWSXP
 Volume Serial Number is 1234-5678

 Directory of C:\

2007.07.05  04:05p    <DIR>          Documents and Settings
2011.05.04  07:38p    <DIR>          Program Files
2010.04.02  11:35p    <DIR>          WINDOWS
2011.10.09  10:45p               454 BOOT.INI
2002.08.28  10:08p            47,580 NTDETECT.COM
2002.08.29  02:05a           233,632 NTLDR
               3 File(s)      281,666 bytes

 Directory of C:\Documents and Settings

2003.11.12  03:08p    <DIR>          .
2003.11.12  03:08p    <DIR>          ..
2007.07.05  10:36p    <DIR>          Administrator
2007.07.05  04:21p    <DIR>          All Users
               0 File(s)              0 bytes

 Directory of C:\Documents and Settings\All Users

2003.11.12  03:08p    <DIR>          .
2003.11.12  03:08p    <DIR>          ..
2007.07.05  04:23p    <DIR>          Application Data
2011.06.23  03:23p    <DIR>          Documents
2011.01.09  12:56p           262,144 ntuser.dat
               1 File(s)      262,144 bytes

...

Desired output:

 Volume in drive C is C-WINDOWSXP
 Volume Serial Number is 1234-5678

 Directory of C:\

2007.07.05  04:05p    <DIR>          Documents and Settings
2011.05.04  07:38p    <DIR>          Program Files
2010.04.02  11:35p    <DIR>          WINDOWS
2011.10.09  10:45p               454 BOOT.INI                 d1183b26 fad47d7d255e1189dbef3003fba96868 39c9bbe3edad58a5bd091ea1db8f9b6cf03f9566
2002.08.28  10:08p            47,580 NTDETECT.COM             a709deed 28a3ac957be5d239a3dd4f3d4cdbf3b8 f5625a158d92478c814df3b33a9ad5fcd5f8a956
2002.08.29  02:05a           233,632 NTLDR                    0d7e47bd 9896e483e211b8cd1fa7bb32572f02ec c57426135d0419985681a674149c88e652c8ec63
               3 File(s)      281,666 bytes
               3 Dir(s)

 Directory of C:\Documents and Settings

2003.11.12  03:08p    <DIR>          .
2003.11.12  03:08p    <DIR>          ..
2007.07.05  10:36p    <DIR>          Administrator
2007.07.05  04:21p    <DIR>          All Users
               0 File(s)              0 bytes
               2 Dir(s)

 Directory of C:\Documents and Settings\All Users

2003.11.12  03:08p    <DIR>          .
2003.11.12  03:08p    <DIR>          ..
2007.07.05  04:23p    <DIR>          Application Data
2011.06.23  03:23p    <DIR>          Documents
2011.01.09  12:56p           262,144 ntuser.dat               fc3d370a b3ea06755f614e2c18fc1de875b60126 8264549330d9dbef494264227be9fadffe653556
               1 File(s)      262,144 bytes
               2 Dir(s)

Best Answer

WinHasher:

WinHasher is a free, Open Source cryptographic hash or digest generator written in C# using Microsoft's .NET 2.0 Framework. It can be used to verify file download integrity, compare two or more files for modifications, and to some degree generate strong, unique passwords.

CommandLine Hash Generator:

cmdhashgen is a Command Line Utility that can be used to generate various hashes for a given String or File.

Supported Hashes are CRC32, MD5, SHA-1, SHA-256, SHA-384 and SHA-512.

WinHasher has command-line utilities including "Hash", which can be tied into a batch file or script. It looks like the more stable of the two packages.

Usage: hash [-md5|-sha1|-sha256|-sha384|-sha512|-ripemd160|-whirlpool|
       -tiger] [-base64|-hexcaps|-bubbab] filename1 [filename2 ...]

WinHasher is a command-line cryptographic hash generator for files.  It
runs in one of two modes:  single file hashing and multi-file comparison.

In single file mode, WinHasher computes the cryptographic hash of the
given file and prints it to the screen.  With no command-line switches,
it computes the SHA-1 hash and displays it in hexadecimal format.  Various
switches allow you to change to other hashing algorithms, such as MD5,
the SHA family, RIPEMD-160, Whirlpool, and Tiger.  The "-base64" switch
causes WinHasher to output hashes in MIME Base64 (RFC 2045) format rather
than hexadecimal, "-hexcaps" outputs hexadecimal with all capital letters,
and "-bubbab" uses Bubble Babble encoding.
Related Question