Changeset View
Changeset View
Standalone View
Standalone View
sbin/md5/md5.1
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.Dd June 19, 2021 | .Dd June 24, 2021 | ||||
.Dt MD5 1 | .Dt MD5 1 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm md5 , sha1 , sha224 , sha256 , sha384 , sha512 , sha512t256 , rmd160 , | .Nm md5 , sha1 , sha224 , sha256 , sha384 , sha512 , sha512t256 , rmd160 , | ||||
.Nm skein256 , skein512 , skein1024 , | .Nm skein256 , skein512 , skein1024 , | ||||
.Nm md5sum , sha1sum , sha224sum , sha256sum , sha384sum , sha512sum , | .Nm md5sum , sha1sum , sha224sum , sha256sum , sha384sum , sha512sum , | ||||
.Nm sha512t256sum , rmd160sum , skein256sum , skein512sum , skein1024sum | .Nm sha512t256sum , rmd160sum , skein256sum , skein512sum , skein1024sum | ||||
.Nd calculate a message-digest fingerprint (checksum) for a file | .Nd calculate a message-digest fingerprint (checksum) for a file | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.Nm | .Nm | ||||
.Op Fl pqrtx | .Op Fl pqrtx | ||||
.Op Fl c Ar string | .Op Fl c Ar string | ||||
.Op Fl s Ar string | .Op Fl s Ar string | ||||
.Op Ar | .Op Ar | ||||
.Pp | |||||
.Nm md5sum | .Nm md5sum | ||||
.Op Fl pqrtx | .Op Fl pqrtx | ||||
.Op Fl c Ar file | .Op Fl c Ar file | ||||
.Op Fl s Ar string | .Op Fl s Ar string | ||||
.Op Ar | .Op Ar | ||||
.Pp | .Pp | ||||
(All other hashes have the same options and usage.) | (All other hashes have the same options and usage.) | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
The hexadecimal checksum of each file listed on the command line is printed | The hexadecimal checksum of each file listed on the command line is printed | ||||
after the options are processed. | after the options are processed. | ||||
.Bl -tag -width indent | .Bl -tag -width indent | ||||
.It Fl b | .It Fl b | ||||
Ignored for compatibility with the coreutils | Ignored for compatibility with the coreutils | ||||
.Nm -sum | .Nm -sum | ||||
programs. | programs. | ||||
.It Fl c Ar string | .It Fl c Ar string | ||||
Compare the digest of the file against this string. | If the program was called with a name that does not end in | ||||
.Nm sum , | |||||
compare the digest of the file against this string. | |||||
.Pq Note that this option is not yet useful if multiple files are specified. | .Pq Note that this option is not yet useful if multiple files are specified. | ||||
This option causes an error in for the | .It Fl c Ar file | ||||
.Nm -sum | If the program was called with a name that does end in | ||||
programs because it check the checksums listed in a file for the coreutils | .Nm sum , | ||||
.Nm -sum | the file passed as argument must contain digest lines generated by the same digest algorithm | ||||
programs that is not yet implemented. | with or without the | ||||
.Fl r | |||||
option | |||||
.Pq i.e. in either classical BSD format or in GNU coreutils format . | |||||
A line with file name followed by | |||||
.Dq : | |||||
and either OK or FAILED is written for each well-formed line in the digest file. | |||||
If applicable, the number of failed comparisons and the number of lines that were | |||||
skipped since they were not well-formed are printed at the end. | |||||
The | |||||
.Fl q | |||||
option can be used to quiesce the output unless there are mismatched entries in | |||||
the digest. | |||||
.Pp | |||||
.It Fl s Ar string | .It Fl s Ar string | ||||
Print a checksum of the given | Print a checksum of the given | ||||
.Ar string . | .Ar string . | ||||
.It Fl p | .It Fl p | ||||
Echo stdin to stdout and append the checksum to stdout. | Echo stdin to stdout and append the checksum to stdout. | ||||
.It Fl q | .It Fl q | ||||
Quiet mode \(em only the checksum is printed out. | Quiet mode \(em only the checksum is printed out. | ||||
Overrides the | Overrides the | ||||
Show All 38 Lines | |||||
.Bd -literal -offset indent | .Bd -literal -offset indent | ||||
$ echo -n Hello | md5 | $ echo -n Hello | md5 | ||||
8b1a9953c4611296a827abf8c47804d7 | 8b1a9953c4611296a827abf8c47804d7 | ||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
Calculate the checksum of multiple files reversing the output: | Calculate the checksum of multiple files reversing the output: | ||||
.Bd -literal -offset indent | .Bd -literal -offset indent | ||||
$ md5 -r /boot/loader.conf /etc/rc.conf | $ md5 -r /boot/loader.conf /etc/rc.conf | ||||
ada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf | ada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf | ||||
d80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf | d80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf | ||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
Write the digest for | Write the digest for | ||||
.Pa /boot/loader.conf | .Pa /boot/loader.conf | ||||
in a file named | in a file named | ||||
.Pa digest . | .Pa digest . | ||||
Then calculate the checksum again and validate it against the checksum string | Then calculate the checksum again and validate it against the checksum string | ||||
extracted from the | extracted from the | ||||
.Pa digest | .Pa digest | ||||
file: | file: | ||||
.Bd -literal -offset indent | .Bd -literal -offset indent | ||||
$ md5 /boot/loader.conf > digest && md5 -c $(cut -f2 -d= digest) /boot/loader.conf | $ md5 /boot/loader.conf > digest && md5 -c $(cut -f2 -d= digest) /boot/loader.conf | ||||
MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 | MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 | ||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
Same as above but comparing the digest against an invalid string | Same as above but comparing the digest against an invalid string | ||||
.Pq Dq randomstring , | .Pq Dq randomstring , | ||||
which results in a failure. | which results in a failure. | ||||
.Bd -literal -offset indent | .Bd -literal -offset indent | ||||
$ md5 -c randomstring /boot/loader.conf | $ md5 -c randomstring /boot/loader.conf | ||||
MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 [ Failed ] | MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 [ Failed ] | ||||
.Ed | .Ed | ||||
.Pp | |||||
If invoked with a name ending in | |||||
.Nm -sum | |||||
the | |||||
.Fl c | |||||
option does not compare against a hash string passed as parameter. | |||||
Instead, it expects a digest file, as created under the name | |||||
.Pa digest | |||||
for | |||||
.Pa /boot/loader.conf | |||||
in the example above. | |||||
.Bd -literal -offset indent | |||||
$ md5 -c digest /boot/loader.conf | |||||
/boot/loader.conf: OK | |||||
.Ed | |||||
.Pp | |||||
The digest file may contain any number of lines in the format generated with or without the | |||||
.Fl r | |||||
option | |||||
.Pq i.e. in either classical BSD format or in GNU coreutils format . | |||||
If a hash value does not match the file, FAILED is printed instead of OK. | |||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr cksum 1 , | .Xr cksum 1 , | ||||
.Xr md5 3 , | .Xr md5 3 , | ||||
.Xr ripemd 3 , | .Xr ripemd 3 , | ||||
.Xr sha 3 , | .Xr sha 3 , | ||||
.Xr sha256 3 , | .Xr sha256 3 , | ||||
.Xr sha384 3 , | .Xr sha384 3 , | ||||
.Xr sha512 3 , | .Xr sha512 3 , | ||||
Show All 22 Lines | |||||
.Pa http://csrc.nist.gov/cryptval/shs.html . | .Pa http://csrc.nist.gov/cryptval/shs.html . | ||||
.Pp | .Pp | ||||
The RIPEMD-160 page: | The RIPEMD-160 page: | ||||
.Pa http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html . | .Pa http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html . | ||||
.Sh BUGS | .Sh BUGS | ||||
All of the utilities that end in | All of the utilities that end in | ||||
.Sq sum | .Sq sum | ||||
are intended to be compatible with the GNU coreutils programs. | are intended to be compatible with the GNU coreutils programs. | ||||
However, the long arguments and the | However, the long option functionality is not provided. | ||||
.Fl -check | |||||
functionality are not provided. | |||||
.Sh ACKNOWLEDGMENTS | .Sh ACKNOWLEDGMENTS | ||||
This program is placed in the public domain for free general use by | This program is placed in the public domain for free general use by | ||||
RSA Data Security. | RSA Data Security. | ||||
.Pp | .Pp | ||||
Support for SHA-1 and RIPEMD-160 has been added by | Support for SHA-1 and RIPEMD-160 has been added by | ||||
.An Oliver Eikemeier Aq Mt eik@FreeBSD.org . | .An Oliver Eikemeier Aq Mt eik@FreeBSD.org . |