md5sum

From Wikipedia, the free encyclopedia
Jump to: navigation, search

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

There are some graphical interfaces but it is also possible to simply run the command (which is case sensitive) followed by the filename to be checked.

  • In Microsoft Windows the Run... command line is usually found within the Start panel,
  • In Linux graphical desktops a command window is usually available in Applications>Accessories>Terminal.

The result will be displayed after a short delay. md5sum can check multiple files and direct the output to a text file as shown below:

[edit] 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

[edit] See also

[edit] External links

Personal tools
Namespaces
Variants
Actions
Navigation
Interaction
Toolbox
Print/export
Languages