- md5sum
-
md5sum is a computer program that calculates and verifies 128-bit MD5 hashes, as described in RFC 1321. The MD5 hash (or checksum) functions as a compact digital fingerprint of a file. As with all such hashing algorithms, there is theoretically an unlimited number of files that will have any given MD5 hash. However, it is unlikely that any two non-identical files will have the same MD5 hash.
Virtually any change to a file will cause its MD5 hash to change; therefore md5sum is used to verify the integrity of files. Most commonly, md5sum is used to verify that a file has not changed as a result of file transfer, disk error or meddling. The md5sum program is installed by default in most Unix, Linux, and Unix-like operating systems or compatibility layers. Other operating systems, including Microsoft Windows and BSD variants — such as Mac OS X - have similar utilities (see external links).
Examples
- Compute the MD5 sum of two files and store it in a third one:
md5sum file1 file2 > files.md5
- This file will have one line per input file. Each line will contain an MD5 sum (32 hexadecimal digits), two spaces and the corresponding input file name. It will look like:
47f4cc0b788002e8b264881beb4ec08b file1 beaa28899c52f9df66094c4267876e78 file2
- Check for validity with:
md5sum -c files.md5
- Expected results:
file1: OK file2: OK
See also
External links
Categories:- Unix security-related software
- Unix file system-related software
- Files
- Cryptographic hash functions
Wikimedia Foundation. 2010.