Home    Download    Change Log    Manual    Hash Functions    Wiki    License  ru | en 

RHash Manual

Table of Contents


rhash - calculate/check CRC32, MD5, SHA1, GOST, TTH, BTIH or other hash sums.


rhash [ option ]... [ file ]...


RHash (Recursive Hasher) computes and verifies various message digests (hash sums) of files. Supported message digests include CRC32, MD4, MD5, SHA1, SHA256, SHA512, SHA3, Tiger, DC++ TTH, BitTorrent BTIH, AICH, ED2K, GOST R 34.11-94, RIPEMD-160, HAS-160, EDON-R 256/512, Whirlpool, Snefru-128/256.

The program can create and verify Magnet links and eDonkey ed2k:// links, see --magnet and --ed2k-link options.

A dash string parameter ‘-’ is interpreted as stdin file.

By default rhash prints sums in SFV format with CRC32 hash sum only. The format can be changed by options --bsd, --magnet, --simple, --printf, --template. To output all sums use the ‘-a’ option.

The default output format can also be changed by renaming the program or placing a hardlink/symlink to it with a name containing strings ‘crc32’, ‘md4’, ‘md5’, ‘sha1’, ‘sha256’ ‘sha512’, ‘tiger’, ‘tth’, ‘btih’, ‘aich’, ‘ed2k’, ‘ed2k-link’, ‘gost’, ‘gost-cryptopro’, ‘ripemd160’, ‘has160’, ‘whirlpool’, ‘edonr256’, ‘edonr512’, ‘snefru128’, ‘snefru256’, ‘sfv’ or ‘magnet’.

Program Mode Options

The default mode is to print hash sums for all files and directory trees specified by command line. The mode can be set by the following options.
-c, --check
Check hash files specified by command line. RHash can verify hash files in SFV and BSD formats, standard MD5 and SHA1 files, and text files containing magnet or ed2k links (one link per line). Empty lines and lines starting with ‘;’ or ‘#’ are skipped. In fact RHash can verify most hash files generated by itself without formating options --printf and --template.
-u, --update
Update hash files specified by command line. The program calculates and appends hashes to the updated hash file in the format specified by formating options. Hashes are calculated for those files from the same directory as the hash file, which are yet not present in it.
-k, --check-embedded
Verify files by crc32 sum embedded in their names.
Create a torrent file for each processed file.
-h, --help
Help: print help screen and exit.
-V, --version
Version: print version and exit.
-B, --benchmark
Run benchmark for selected algorithm(s).

Hash Sums Options

-C, --crc32
CRC32: calculate and print CRC32 hash sum.
MD4: calculate and print MD4 hash sum.
-M, --md5
MD5: calculate and print MD5 hash sum.
-H, --sha1
SHA1: calculate and print SHA1 hash sum.
--sha224, --sha256, --sha384, --sha512
Calculate specified SHA2 hash sum.
--sha3-224, --sha3-256, --sha3-384, --sha3-512
Calculate specified SHA3 hash sum.
Tiger: calculate and print Tiger hash sum.
-T, --tth
TTH: calculate and print DC++ TTH sum.
BTIH: calculate and print BitTorrent Info Hash.
-A, --aich
AICH: calculate and print AICH hash.
-E, --ed2k
ED2K: calculate and print eDonkey 2000 hash sum.
-L, --ed2k-link
eDonkey link: calculate and print eDonkey link.
-W, --whirlpool
Whirlpool: calculate and print Whirlpool hash sum.
-G, --gost
GOST: calculate and print GOST R 34.11-94 hash, the Russian GOST standard hash function.
GOST-CRYPTOPRO: calculate and print CryptoPro version of the GOST R 34.11-94 hash function.
RIPEMD-160: calculate and print RIPEMD-160 hash sum.
HAS-160: calculate and print HAS-160 hash sum.
--snefru128, --snefru256
SNEFRU: calculate and print SNEFRU-128/256 hash sums.
--edonr256, --edonr512
EDON-R: calculate and print EDON-R 256/512 hash sums.

-a, --all
Calculate all supported hash sums.
List names of all supported hashes, one per line.

Miscellaneous Options

-r, --recursive
Process directories recursively.
-v, --verbose
Be verbose.
Show percents, while calculating or checking sums
Don’t print OK messages for successfully verified files.
-i, --ignore-case
Ignore case of filenames when updating crc files.
Print per-file and the total processing speed.
-e, --embed-crc
Rename files by inserting crc32 sum into name.
Insert specified <delimiter> before a crc sum in the --embed-crc mode, default is white space. The <delimiter> can be a character or empty string.
Use specified path separator to display paths.
-q, --accept=<list>
Set a comma-delimited list of extensions of the files to process.
Set a comma-delimited list of extensions of the files to exclude from processing.
-t, --crc-accept=<list>
Set a comma-delimited list of extensions of the hash files to verify.
Descend at most <levels> (a non-negative integer) levels of directories below the command line arguments. ‘--maxdepth 0’ means only apply the tests and actions to the command line arguments.
-o, --output=<file-path>
Set the file to output calculated hashes and verification results to.
-l, --log=<file-path>
Set the file to log errors and verbose information to.
Specify which hash functions should be calculated using the OpenSSL library. The <list> is a comma delimited list of hash names, but only those supported by openssl are allowed, e.g. md4, md5, sha1, sha256, ripemd160. See openssl documentation for the full list.
Reverse bytes in hexadecimal output of the GOST hash sum. The most significant bytes of the hash will be printed first. Default order is the least significant bytes first.
Turn on torrent batch mode (implies torrent mode). Calculates batch-torrent for the files specified at command line and saves the torrent file to the file-path. The option -r <directory> can be useful in this mode.
Generate BTIH for a private BitTorrent tracker.
Set the piece length value for torrent file.
Add a tracker announce URL to the created torrent file(s). Several URLs can be passed by specifying the option mutltiple times. This option doesn’t change the BTIH hash.
Switch benchmark output format to be a machine-readable tab-delimited text with hash function name, speed, cpu clocks per byte. This option works only if the --benchmark option was specified.
-- (double dash)
Mark the end of command line options. All parameters following the double dash are interpreted as files or directories. It is typically used to process filenames starting with a dash ‘-’. Alternatively you can specify ’./’ or full path before such files, so they will not look like options anymore.

Output Format Options

Use Windows codepage for output.
Use DOS (OEM) codepage for output.
Use UTF-8 codepage for output.
Print hash sums in the SFV (Simple File Verification) output format (default). But unlike common SFV file, not only CRC32, but any hash sums specified by options can be printed.
-m, --magnet
Print hash sums formatted as magnet links.
Use BSD output format. Each hash sum is printed on separate line after hash name and file’s path, enclosed in parentheses.
Use simple output format. Each line will consist of filename and hash sums specified by options.
Print hash sums in upper case.
Print hash sums in lower case.
Read printf-like template from given <file>. See the --printf option.
-p, --printf=<format>
Format: print format string the standard output, interpreting ‘\’ escapes and ‘%’ directives. The escapes and directives are:
Carriage return.
Horizontal tab.
A literal backslash (‘\’).
The character which octal ASCII code is NNN.
The character which hexadecimal ASCII code is NN.

A ‘\’ character followed by any other character is treated as an ordinary character, so they both are printed.

A literal percent sign.
File’s path.
File’s name.
URL-encoded filename.
File’s size in bytes.
File’s last modification time.
%a or %A
AICH hash sum.
%c or %C
CRC32 hash sum. Use %c for lowercase and %C for uppercase characters.
%g or %G
GOST R 34.11-94 hash.
%h or %H
SHA1 hash.
%e or %E
ED2K hash sum.
%l or %L
EDonkey ed2k://... link.
%m or %M
MD5 hash.
%r or %R
RIPEMD-160 hash.
%t or %T
TTH sum.
%w or %W
Whirlpool hash.
%{md4}, %{sha-224}, %{sha-256}, %{sha-384}, %{sha-512}, %{sha3-224},
%{sha3-256}, %{sha3-384}, %{sha3-512} %{tiger}, %{btih}, %{gost-cryptopro},
%{has160}, %{snefru128}, %{snefru256}, %{edon-r256}, %{edon-r512}"
Print specified hash sum. Actually the %{<hash sum>} directive can print any supported hash sum. If a hash sum name starts with a capital letter then the hash is printed in uppercase, e.g. %{TTH}, %{Sha-512}.
%x<hash>, %b<hash>, %B<hash>, %@<hash>
Use one of these prefixes to output a hash sum in hexadecimal, base32, base64 or raw (binary) format respectively, e.g. %b{md4}, %BH or %xT.

Config File

RHash looks for a config file on Windows at %APPDATA%\RHash\rhashrc, %HOMEDRIVE%%HOMEPATH%\rhashrc, {PROGRAM_DIRECTORY}\rhashrc

and on Linux/Unix at $HOME/.rhashrc and /etc/rhashrc.

The config file consists of lines formatted as

variable = value

where the variable can be a name of any command line option, like magnet, printf, percents, etc. A boolean variable can be set to true by a value ‘on’, ‘yes’ or ‘true’, any other value sets the variable to false.

Empty lines and lines starting with ‘#’ or ‘;’ are ignored.

Example config file:

# This is a comment line
percents = on
crc-accept = .sfv,.md5,.sha1,.sha256,.sha512,.tth,.magnet


Aleksey Kravchenko <rhash.admin@gmail.com>

See Also

md5sum(1) cksfv(1) ed2k_hash(1)


Bug reports are welcome! Send them by email or post to the SourceForge Bug Tracking System http://sourceforge.net/projects/rhash/

Table of Contents