1*80461f24Smillert.\" $OpenBSD: md5.1,v 1.50 2023/10/31 20:42:14 millert Exp $ 22214524aSmillert.\" 3bf198cc6Smillert.\" Copyright (c) 2003, 2004, 2006 Todd C. Miller <millert@openbsd.org> 42214524aSmillert.\" 506f01696Smillert.\" Permission to use, copy, modify, and distribute this software for any 606f01696Smillert.\" purpose with or without fee is hereby granted, provided that the above 706f01696Smillert.\" copyright notice and this permission notice appear in all copies. 82214524aSmillert.\" 9328f1f07Smillert.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10328f1f07Smillert.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11328f1f07Smillert.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12328f1f07Smillert.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13328f1f07Smillert.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14328f1f07Smillert.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15328f1f07Smillert.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16328f1f07Smillert.\" 17328f1f07Smillert.\" Sponsored in part by the Defense Advanced Research Projects 18328f1f07Smillert.\" Agency (DARPA) and Air Force Research Laboratory, Air Force 19328f1f07Smillert.\" Materiel Command, USAF, under agreement number F39502-99-1-0512. 20a90f5567Sderaadt.\" 21*80461f24Smillert.Dd $Mdocdate: October 31 2023 $ 223dc0a83cSmillert.Dt MD5 1 233dc0a83cSmillert.Os 243dc0a83cSmillert.Sh NAME 25f533af49Sschwarze.Nm md5 , 26f533af49Sschwarze.Nm sha1 , 27f533af49Sschwarze.Nm sha256 , 28f533af49Sschwarze.Nm sha512 2911589f11Sjmc.Nd calculate a message digest (checksum) for a file 303dc0a83cSmillert.Sh SYNOPSIS 317349792aSaaron.Nm md5 3237111688Sjmc.Op Fl bcpqrtx 332d961736Slteo.Op Fl C Ar checklist 34043177f7Sderaadt.Op Fl h Ar hashfile 35dedc694dSjmc.Op Fl s Ar string 36dedc694dSjmc.Op Ar 3728b664e9Sderaadt.Nm sha1 3837111688Sjmc.Op Fl bcpqrtx 392d961736Slteo.Op Fl C Ar checklist 4028b664e9Sderaadt.Op Fl h Ar hashfile 4128b664e9Sderaadt.Op Fl s Ar string 4228b664e9Sderaadt.Op Ar 4328b664e9Sderaadt.Nm sha256 4437111688Sjmc.Op Fl bcpqrtx 452d961736Slteo.Op Fl C Ar checklist 4628b664e9Sderaadt.Op Fl h Ar hashfile 4728b664e9Sderaadt.Op Fl s Ar string 4828b664e9Sderaadt.Op Ar 4928b664e9Sderaadt.Nm sha512 5037111688Sjmc.Op Fl bcpqrtx 512d961736Slteo.Op Fl C Ar checklist 5228b664e9Sderaadt.Op Fl h Ar hashfile 5328b664e9Sderaadt.Op Fl s Ar string 5428b664e9Sderaadt.Op Ar 553dc0a83cSmillert.Sh DESCRIPTION 56795c819dSderaadtThese utilities take as input a message of arbitrary length and produce 5728b664e9Sderaadtas output a message digest (checksum) of the input. 58b910db82Smillert.Pp 597b6556b6SdanielTwo messages having the same message digest (a collision) have been produced 607b6556b6Sdanielfor MD5 and for SHA-1, so their use is deprecated. 618bdf4526Saaron.Pp 6228b664e9SderaadtThe options for use with each command are as follows: 63f1ba3473Saaron.Bl -tag -width Ds 641c45a514Smillert.It Fl b 65b00659e1SmillertOutput checksums in base64 notation, not hexadecimal. 662d961736Slteo.It Fl C Ar checklist 672d961736SlteoCompare the checksum of each 682d961736Slteo.Ar file 692d961736Slteoagainst the checksums in the 702d961736Slteo.Ar checklist . 712d961736SlteoAny specified 722d961736Slteo.Ar file 732d961736Slteothat is not listed in the 742d961736Slteo.Ar checklist 75e15dc49bSlteowill generate an error. 7628b664e9Sderaadt.It Fl c 7728b664e9SderaadtIf this option is specified, the 7828b664e9Sderaadt.Ar file 7928b664e9Sderaadtoptions become checklists. 80*80461f24SmillertEach checklist should contain hash results, which will be verified 81*80461f24Smillertagainst the specified paths. 82*80461f24SmillertBoth normal (BSD) and reverse (GNU) forms are supported in either 83*80461f24Smillerthexadecimal or base64 format. 848346ca8aSjmcOutput consists of the digest used, the file name, 85d85331eeSlteoand an OK, FAILED, or MISSING for the result of the comparison. 86*80461f24SmillertEntries in normal format can be validated using any of the supported checksums 87*80461f24Smillert(see 88cc6ea15bSmillert.Xr cksum 1 ) . 89*80461f24SmillertEntries in reverse format are validated using the default algorithm. 908346ca8aSjmcIf no file is given, stdin is used. 9108e96065Sjmc.It Fl h Ar hashfile 9208e96065SjmcPlace the checksum into 9308e96065Sjmc.Ar hashfile 9408e96065Sjmcinstead of stdout. 953dc0a83cSmillert.It Fl p 967ac65e42SknEcho stdin to stdout and append the 9711589f11Sjmcchecksum to stdout. 98de516bc0Smillert.It Fl q 99f0a3752aSjmcOnly print the checksum (quiet mode) or if used in conjunction with the 100f0a3752aSjmc.Fl c 101f0a3752aSjmcflag, only print the failed cases. 102de516bc0Smillert.It Fl r 103*80461f24SmillertReverse the format of the hash algorithm output, similar to 104*80461f24Smillertthe output format used by 105*80461f24Smillert.Xr cksum 1 106*80461f24Smillert(but without the number of octets). 107*80461f24SmillertThis is also the format used by the GNU 108*80461f24Smillert.Xr cksum 1 109*80461f24Smillertutility. 110847ab813Sjmc.It Fl s Ar string 1117ac65e42SknPrint a checksum of the given 112847ab813Sjmc.Ar string . 1133dc0a83cSmillert.It Fl t 1147ac65e42SknRun a built-in time trial. 115b313c254SteduSpecifying 116b313c254Stedu.Fl t 117b313c254Stedumultiple times results in the number of rounds being multiplied 118b313c254Steduby 10 for each additional flag. 1193dc0a83cSmillert.It Fl x 1207ac65e42SknRun a built-in test script. 1213dc0a83cSmillert.El 12259a5f2b9Sjmc.Sh EXIT STATUS 12337111688SjmcThese utilities exit 0 on success, 12437111688Sjmcand \*(Gt0 if an error occurs. 1253dc0a83cSmillert.Sh SEE ALSO 12628b664e9Sderaadt.Xr cksum 1 127d63ef1c1Sjmc.Sh STANDARDS 1282be2c9c9Stom.Rs 1292be2c9c9Stom.%A R. Rivest 130d63ef1c1Sjmc.%D April 1992 131d63ef1c1Sjmc.%R RFC 1321 1322be2c9c9Stom.%T The MD5 Message-Digest Algorithm 1332be2c9c9Stom.Re 13428b664e9Sderaadt.Rs 13528b664e9Sderaadt.%A J. Burrows 13628b664e9Sderaadt.%O FIPS PUB 180-1 13728b664e9Sderaadt.%T The Secure Hash Standard 13828b664e9Sderaadt.Re 13928b664e9Sderaadt.Pp 14028b664e9Sderaadt.Rs 14128b664e9Sderaadt.%A D. Eastlake 14228b664e9Sderaadt.%A P. Jones 14328b664e9Sderaadt.%D September 2001 14428b664e9Sderaadt.%R RFC 3174 14528b664e9Sderaadt.%T US Secure Hash Algorithm 1 (SHA1) 14628b664e9Sderaadt.Re 14728b664e9Sderaadt.Rs 14828b664e9Sderaadt.%T Secure Hash Standard 14928b664e9Sderaadt.%O FIPS PUB 180-2 15028b664e9Sderaadt.Re 151