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.

-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.

--torrent

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

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

Tiger: calculate and print Tiger hash sum.

-T, --tth

TTH: calculate and print DC++ TTH sum.

--btih

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

GOST-CRYPTOPRO: calculate and print CryptoPro version of the GOST R 34.11-94 hash function.

--ripemd160

RIPEMD-160: calculate and print RIPEMD-160 hash sum.

--has160

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-hashes

List names of all supported hashes, one per line.

MISCELLANEOUS OPTIONS

-r, --recursive

Process directories recursively.

-v, --verbose

Be verbose.

--percents

Show percents, while calculating or checking sums

--skip-ok

Don't print OK messages for successfully verified files.

-i, --ignore-case

Ignore case of filenames when updating crc files.

--speed

Print per-file and the total processing speed.

-e, --embed-crc

Rename files by inserting crc32 sum into name.

--embed-crc-delimiter=<delimiter>

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.

--path-separator=<separator>

Use specified path separator to display paths.

-q, --accept=<list>

Set a comma\(hydelimited list of extensions of the files to process.

--exclude=<list>

Set a comma\(hydelimited list of extensions of the files to exclude from processing.

-t, --crc-accept=<list>

Set a comma\(hydelimited list of extensions of the hash files to verify.

--maxdepth=<levels>

Descend at most <levels> (a non\(hynegative 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.

--openssl=<list>

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.

--gost-reverse

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.

--bt-batch=<file-path>

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.

--bt-private

Generate BTIH for a private BitTorrent tracker.

--bt-piece-length

Set the piece length value for torrent file.

--bt-announce

Add a tracker announce URL to the created torrent file(s). This option can be passed mutltiple times to add several urls. Note that this option doesn't change the BTIH hash.

--benchmark-raw

Switch benchmark output format to be a machine\(hyreadable tab\(hydelimited 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

--sfv

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 formated as magnet links.

--bsd

Use BSD output format. Each hash sum is printed on separate line after hash name and file's path, enclosed in parentheses.

--simple

Use simple output format. Each line will consist of filename and hash sums specified by options.

--uppercase

Print hash sums in upper case.

--lowercase

Print hash sums in lower case.

--template=<file>

Read printf\(hylike 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:

\n

Newline.

\r

Carriage return.

\t

Horizontal tab.

\\

A literal backslash (`\').

\0

ASCII NUL.

\NNN

The character which octal ASCII code is NNN.

\xNN

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\(hyencoded 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 formated 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 <[email protected]>

RELATED TO magnet-link…

BUGS

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