Md5sum
Template:Short description Template:Lowercase title {{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1 | unknown = Template:Main other | preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y | AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid }}Template:Main other Template:Mono is a computer program that calculates and verifies 128-bit MD5 hashes, as described in RFC 1321. The MD5 hash 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 very unlikely that any two non-identical files in the real world will have the same MD5 hash, unless they have been specifically created to have the same hash.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
The underlying MD5 algorithm is no longer deemed secure. Thus, while Template:Mono is well-suited for identifying known files in situations that are not security related, it should not be relied on if there is a chance that files have been purposefully and maliciously tampered. In the latter case, the use of a newer hashing tool such as sha256sum is recommended.
Template:Mono is used to verify the integrity of files, as virtually any change to a file will cause its MD5 hash to change. Most commonly, Template:Mono is used to verify that a file has not changed as a result of a faulty file transfer, a disk error or non-malicious meddling. The Template:Mono program is included in most Unix-like operating systems or compatibility layers such as Cygwin.
The original C code was written by Ulrich Drepper and extracted from a 2001 release of Template:Mono.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
ExamplesEdit
All of the following files are assumed to be in the current directory.
Create MD5 hash file hash.md5Edit
<syntaxhighlight lang="bash"> $ md5sum filetohashA.txt filetohashB.txt filetohashC.txt > hash.md5 </syntaxhighlight>
File producedEdit
File contains hash and filename pairs: <syntaxhighlight lang="console"> $ cat hash.md5 595f44fec1e92a71d3e9e77456ba80d1 filetohashA.txt 71f920fa275127a7b60fa4d4d41432a3 filetohashB.txt 43c191bf6d6c3f263a8cd0efd4a058ab filetohashC.txt </syntaxhighlight>
Please note:
- There must be two spaces or a space and an asterisk between each Template:Mono value and filename to be compared (the second space indicates text mode, the asterisk binary mode). Otherwise, the following error will result:
no properly formatted MD5 checksum lines found
. Many programs don't distinguish between the two modes, but some utils do. - The file must be also be UNIX line ending formatted, otherwise this will be seen:
md5sum: WARNING: x listed files could not be read
. Template:Mono will convert it quickly if it is DOS/Windows formatted.
Check MD5Edit
<syntaxhighlight lang="console"> $ md5sum -c hash.md5 filetohashA.txt: OK filetohashB.txt: OK filetohashC.txt: OK </syntaxhighlight>
Check single MD5Edit
<syntaxhighlight lang="console"> $ echo 'D43F2404CA13E22594E5C8B04D3BBB81 filetohashA.txt' | md5sum -c filetohashA.txt: OK </syntaxhighlight>
On non-GNU systemsEdit
<syntaxhighlight lang="text" class="" style="" inline="1">md5sum</syntaxhighlight> is specific to systems that use GNU coreutils or a clone such as BusyBox. On FreeBSD and OpenBSD the utilities are called Template:Mono, Template:Mono, Template:Mono, and Template:Mono. These versions offer slightly different options and features. Additionally, FreeBSD offers the "SKEIN" family of message digests.<ref>Template:Man</ref>