1.\" $OpenBSD: md5.1,v 1.45 2015/09/23 17:39:36 jmc Exp $ 2.\" 3.\" Copyright (c) 2003, 2004, 2006 Todd C. Miller <Todd.Miller@courtesan.com> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.\" Sponsored in part by the Defense Advanced Research Projects 18.\" Agency (DARPA) and Air Force Research Laboratory, Air Force 19.\" Materiel Command, USAF, under agreement number F39502-99-1-0512. 20.\" 21.Dd $Mdocdate: September 23 2015 $ 22.Dt MD5 1 23.Os 24.Sh NAME 25.Nm md5 , 26.Nm sha1 , 27.Nm sha256 , 28.Nm sha512 29.Nd calculate a message digest (checksum) for a file 30.Sh SYNOPSIS 31.Nm md5 32.Op Fl bcpqrtx 33.Op Fl C Ar checklist 34.Op Fl h Ar hashfile 35.Op Fl s Ar string 36.Op Ar 37.Nm sha1 38.Op Fl bcpqrtx 39.Op Fl C Ar checklist 40.Op Fl h Ar hashfile 41.Op Fl s Ar string 42.Op Ar 43.Nm sha256 44.Op Fl bcpqrtx 45.Op Fl C Ar checklist 46.Op Fl h Ar hashfile 47.Op Fl s Ar string 48.Op Ar 49.Nm sha512 50.Op Fl bcpqrtx 51.Op Fl C Ar checklist 52.Op Fl h Ar hashfile 53.Op Fl s Ar string 54.Op Ar 55.Sh DESCRIPTION 56These utilities take as input a message of arbitrary length and produce 57as output a message digest (checksum) of the input. 58It is conjectured that it is computationally infeasible to produce 59two messages having the same message digest (a collision), 60or to produce any message having a given prespecified target message digest. 61The algorithm (MD5, SHA-1, SHA-256, SHA-512) is determined by the 62name used to invoke the utility. 63.Pp 64Collisions have now been produced for MD5, and are theorized for SHA-1, 65so their use is deprecated. 66.Pp 67The options for use with each command are as follows: 68.Bl -tag -width Ds 69.It Fl b 70Output checksums in base64 notation, not hexadecimal. 71.It Fl C Ar checklist 72Compare the checksum of each 73.Ar file 74against the checksums in the 75.Ar checklist . 76Any specified 77.Ar file 78that is not listed in the 79.Ar checklist 80will generate an error. 81.It Fl c 82If this option is specified, the 83.Ar file 84options become checklists. 85Each checklist should contain hash results in the normal format, 86which will be verified against the specified paths. 87Output consists of the digest used, the file name, 88and an OK, FAILED, or MISSING for the result of the comparison. 89This will validate any of the supported checksums (see 90.Xr cksum 1 ) . 91If no file is given, stdin is used. 92.It Fl h Ar hashfile 93Place the checksum into 94.Ar hashfile 95instead of stdout. 96.It Fl p 97Echoes stdin to stdout and appends the 98checksum to stdout. 99.It Fl q 100Only print the checksum (quiet mode). 101.It Fl r 102Reverse the format of the hash algorithm output, making 103it match the output format used by 104.Xr cksum 1 . 105.It Fl s Ar string 106Prints a checksum of the given 107.Ar string . 108.It Fl t 109Runs a built-in time trial. 110Specifying 111.Fl t 112multiple times results in the number of rounds being multiplied 113by 10 for each additional flag. 114.It Fl x 115Runs a built-in test script. 116.El 117.Sh EXIT STATUS 118These utilities exit 0 on success, 119and \*(Gt0 if an error occurs. 120.Sh SEE ALSO 121.Xr cksum 1 122.Sh STANDARDS 123.Rs 124.%A R. Rivest 125.%D April 1992 126.%R RFC 1321 127.%T The MD5 Message-Digest Algorithm 128.Re 129.Rs 130.%A J. Burrows 131.%O FIPS PUB 180-1 132.%T The Secure Hash Standard 133.Re 134.Pp 135.Rs 136.%A D. Eastlake 137.%A P. Jones 138.%D September 2001 139.%R RFC 3174 140.%T US Secure Hash Algorithm 1 (SHA1) 141.Re 142.Rs 143.%T Secure Hash Standard 144.%O FIPS PUB 180-2 145.Re 146