Scroll to navigation

RHASH(1) User Manuals RHASH(1)

NAME

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

SYNOPSIS

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

DESCRIPTION

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.

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.
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.
Verify files by crc32 sum embedded in their names.
Create a torrent file for each processed file.
Help: print help screen and exit.
Version: print version and exit.
Run benchmark for selected algorithm(s).

HASH SUMS OPTIONS

CRC32: calculate and print CRC32 hash sum.
MD4: calculate and print MD4 hash sum.
MD5: calculate and print MD5 hash sum.
SHA1: calculate and print SHA1 hash sum.
Calculate specified SHA2 hash sum.
Calculate specified SHA3 hash sum.
Tiger: calculate and print Tiger hash sum.
TTH: calculate and print DC++ TTH sum.
BTIH: calculate and print BitTorrent Info Hash.
AICH: calculate and print AICH hash.
ED2K: calculate and print eDonkey 2000 hash sum.
eDonkey link: calculate and print eDonkey link.
Whirlpool: calculate and print Whirlpool hash sum.
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.
SNEFRU: calculate and print SNEFRU-128/256 hash sums.
EDON-R: calculate and print EDON-R 256/512 hash sums.

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

MISCELLANEOUS OPTIONS

Process directories recursively.
Be verbose.
Show percents, while calculating or checking sums
Don't print OK messages for successfully verified files.
Ignore case of filenames when updating crc files.
Print per-file and the total processing speed.
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.
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.
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.
Set the file to output calculated hashes and verification results to.
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

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.
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.
Format: print format string the standard output, interpreting `\' escapes and `%' directives. The escapes and directives are:
Newline.
Carriage return.
Horizontal tab.
\\
A literal backslash (`\').
\0
ASCII NUL.
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.
%p
File's path.
%f
File's name.
%u
URL‐encoded filename.
%s
File's size in bytes.
%{mtime}
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 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

AUTHOR

Aleksey Kravchenko <rhash.admin@gmail.com>

SEE ALSO

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

BUGS

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

APR 2010 Linux