Can unrar Generate MD5 Checksum Files?
The command-line tool unrar cannot natively generate
external checksum files, such as .md5 or
.sha256, alongside extracted files. While
unrar includes built-in integrity verification mechanisms
to ensure extracted files are not corrupt, creating standalone digest
files requires pairing unrar with external hashing
utilities. This guide outlines how unrar handles checksum
verification internally and provides practical shell commands to
automatically generate checksum files immediately after extraction on
Linux, macOS, and Windows.
How unrar Handles File Integrity
RAR archives contain internal checksums for every compressed file.
Depending on the archive version, WinRAR and rar embed
either CRC32 hashes (RAR4 format) or BLAKE2sp hashes (RAR5 format)
directly within the archive metadata.
When you run an extraction command such as
unrar x archive.rar or a test command like
unrar t archive.rar, the utility automatically calculates
the checksum of the unpacked data and compares it against the stored
value. If a mismatch occurs, unrar flags a checksum error.
However, unrar lacks any command-line switch or
configuration setting to export these internal hashes into an external
hash list or to calculate third-party digests like MD5 or SHA-256 during
extraction.
Generating Checksum Files on Linux and macOS
To create a checksum file alongside your unpacked data, you can chain
unrar with standard Unix hashing tools such as
md5sum or sha256sum.
To extract into a specific folder and immediately generate an MD5 checksum file for all extracted contents:
unrar x archive.rar output_dir/ && cd output_dir && md5sum * > checksums.md5If the archive contains subdirectories and you need recursive
hashing, use find:
unrar x archive.rar output_dir/ && cd output_dir && find . -type f -not -name "checksums.md5" -exec md5sum {} + > checksums.md5To create SHA-256 files instead, substitute md5sum with
sha256sum.
Generating Checksum Files on Windows (PowerShell)
On Windows systems, you can achieve the same automated workflow using
PowerShell alongside the unrar.exe executable and the
Get-FileHash cmdlet.
To extract the archive and generate an MD5 checksum file:
unrar.exe x archive.rar output_dir\
Get-ChildItem -Path output_dir -File -Recurse | Get-FileHash -Algorithm MD5 | Format-Table Hash, Path > output_dir\checksums.md5For a standard SHA-256 hash list, replace -Algorithm MD5
with -Algorithm SHA256.
Conclusion
While unrar guarantees that extracted files match the
state in which they were originally archived via its internal CRC32 or
BLAKE2 algorithms, it does not support generating external checksum
files. The standard and most reliable practice is to chain the
extraction command with native operating system hashing tools.