rhash
Calculate and verify file hashes
TLDR
Calculate default CRC32 digests of a file
Recursively process a directory to generate an SFV file using SHA1
Verify the integrity of files based on an SFV file
Calculate the SHA3 digest of a text message
Calculate CRC32 digest of a file and output digest encoded in base64 using BSD format
Use custom output template
SYNOPSIS
rhash [OPTIONS] [FILE...]
rhash -c HASH_FILE
PARAMETERS
-a, --algorithms=ALGO
Selects which hash algorithms to use. Example: -a MD5,SHA1.
-c, --check
Checks hash sums against a file containing previously generated hashes. This mode is used for verification.
-r, --recursive
Processes directories recursively, calculating hashes for all files within them.
-o, --output=FILE
Writes the generated hash sums or magnet links to the specified output file instead of stdout.
--magnet
Generates a magnet link for the specified file(s) or directory.
-v, --verbose
Increases the verbosity of the output, showing more details about the process.
-q, --quiet
Suppresses non-error messages, outputting only hash sums or errors.
-L, --lowercase
Outputs hash sums using lowercase hexadecimal characters.
-U, --uppercase
Outputs hash sums using uppercase hexadecimal characters.
-h, --help
Displays a help message with available options and usage.
-V, --version
Prints the program's version information.
DESCRIPTION
rhash is a versatile command-line utility designed for calculating and verifying cryptographic hash sums of files and directories. It supports a wide array of hash algorithms, including but not limited to MD5, SHA1, SHA256, SHA512, BTIH (BitTorrent Info Hash), AICH (Advanced Intelligent Corruptions Hash), ED2K (eDonkey2000), TTH (Tiger Tree Hash), GMD (GOST Hash), and CRC32. This tool is invaluable for ensuring data integrity, verifying downloads, and detecting accidental or malicious modifications. A key feature of rhash is its ability to generate magnet links, which are commonly used in BitTorrent for identifying and locating files without requiring a .torrent file. It can process single files, entire directories recursively, and also verify hash sums against a list provided in a file, making it a powerful utility for file management and data validation tasks.
CAVEATS
Calculating hashes for extremely large files or numerous files in a directory can be resource-intensive and time-consuming. Users should be aware of potential performance implications. While rhash supports various cryptographic hash algorithms, the security strength depends on the algorithm chosen, not rhash itself. Magnet link generation for very large directories might consume significant memory.
MAGNET LINK GENERATION
rhash excels at generating magnet links, which are hyperlinks containing enough information to locate and download files via peer-to-peer networks, primarily BitTorrent. This feature allows users to share file references without needing to distribute a full .torrent file, simplifying content distribution and verification. Use the --magnet option to generate these links.
SUPPORTED HASH ALGORITHMS
Beyond common algorithms like MD5, SHA1, and SHA256, rhash supports a broad spectrum of hashing functions. These include more specialized ones like BTIH (BitTorrent Info Hash), AICH (Advanced Intelligent Corruptions Hash), ED2K (eDonkey2000 hash), TTH (Tiger Tree Hash), and GMD (GOST R 34.11-94), providing flexibility for diverse integrity checking and verification needs.
HISTORY
The rhash utility was developed by Aleksey Cherepanov as an open-source project. Its development aimed to provide a comprehensive and efficient command-line tool for calculating various cryptographic hash sums, addressing a need for a single utility capable of handling multiple algorithms beyond the standard MD5 or SHA-1. Its integration of magnet link generation further distinguishes it, making it particularly valuable in peer-to-peer file sharing contexts like BitTorrent.