HOME

TheInfoList



OR:

is a
computer program A computer program is a sequence or set of instructions in a programming language for a computer to Execution (computing), execute. Computer programs are one component of software, which also includes software documentation, documentation and oth ...
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. The underlying MD5 algorithm is no longer deemed secure. Thus, while 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 a computer program that calculates and verifies SHA-1 hashes. It is commonly used to verify the integrity of files. It (or a variant) is installed by default on most Linux distributions. Typically distributed alongside are , , and , which ...
is recommended. is used to verify the integrity of files, as virtually any change to a file will cause its MD5 hash to change. Most commonly, 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 program is included in most
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
operating systems An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
or
compatibility layer In software engineering, a compatibility layer is an interface that allows binaries for a legacy or foreign system to run on a host system. This translates system calls for the foreign system into native system calls for the host system. With s ...
s such as
Cygwin Cygwin ( ) is a POSIX-compatible programming and runtime environment that runs natively on Microsoft Windows. Under Cygwin, source code designed for Unix-like operating systems may be compiled with minimal modification and executed. The Cygwin in ...
. The original C code was written by Ulrich Drepper and extracted from a 2001 release of .


Examples

All of the following files are assumed to be in the current directory.


Create MD5 hash file hash.md5

$ md5sum filetohashA.txt filetohashB.txt filetohashC.txt > hash.md5


File produced

File contains hash and filename pairs: $ cat hash.md5 595f44fec1e92a71d3e9e77456ba80d1 filetohashA.txt 71f920fa275127a7b60fa4d4d41432a3 filetohashB.txt 43c191bf6d6c3f263a8cd0efd4a058ab filetohashC.txt Please note: * After the value there must be a space followed by either a second space (for text mode) or an asterisk (for 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 also be UNIX line ending formatted, otherwise this will be seen: md5sum: WARNING: x listed files could not be read. will convert it quickly if it is DOS/Windows formatted.


Check MD5

$ md5sum -c hash.md5 filetohashA.txt: OK filetohashB.txt: OK filetohashC.txt: OK


Check single MD5

$ echo 'D43F2404CA13E22594E5C8B04D3BBB81 filetohashA.txt' , md5sum -c filetohashA.txt: OK


On non-GNU UNIX-like systems

is specific to systems that use
GNU coreutils The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were c ...
or a clone such as
BusyBox BusyBox is a software suite that provides several Unix utilities in a single executable file. It runs in a variety of POSIX environments such as Linux, Android, and FreeBSD, although many of the tools it provides are designed to work with inte ...
. On
FreeBSD FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
and
OpenBSD OpenBSD is a security-focused, free and open-source, Unix-like operating system based on the Berkeley Software Distribution (BSD). Theo de Raadt created OpenBSD in 1995 by forking NetBSD 1.0. According to the website, the OpenBSD project e ...
the utilities are called , , , and . These versions offer slightly different options and features. Additionally, FreeBSD offers the "SKEIN" family of message digests.


On Windows systems


Print MD5 hash of a file

> certutil -hashfile MD5 MD5 hash of : CertUtil: -hashfile command completed successfully.


See also

* *


References


External links

* {{Core Utilities commands Unix security-related software Unix file system-related software