1.\" $OpenBSD: md5.1,v 1.43 2014/03/07 04:10:55 lteo 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: March 7 2014 $ 22.Dt MD5 1 23.Os 24.Sh NAME 25.Nm md5 26.Nd calculate a message digest (checksum) for a file 27.Sh SYNOPSIS 28.Nm md5 29.Op Fl bcpqrtx 30.Op Fl C Ar checklist 31.Op Fl h Ar hashfile 32.Op Fl s Ar string 33.Op Ar 34.Nm sha1 35.Op Fl bcpqrtx 36.Op Fl C Ar checklist 37.Op Fl h Ar hashfile 38.Op Fl s Ar string 39.Op Ar 40.Nm sha256 41.Op Fl bcpqrtx 42.Op Fl C Ar checklist 43.Op Fl h Ar hashfile 44.Op Fl s Ar string 45.Op Ar 46.Nm sha512 47.Op Fl bcpqrtx 48.Op Fl C Ar checklist 49.Op Fl h Ar hashfile 50.Op Fl s Ar string 51.Op Ar 52.Sh DESCRIPTION 53These utilities take as input a message of arbitrary length and produce 54as output a message digest (checksum) of the input. 55It is conjectured that it is computationally infeasible to produce 56two messages having the same message digest (a collision), 57or to produce any message having a given prespecified target message digest. 58The algorithm (MD5, SHA-1, SHA-256, SHA-512) is determined by the 59name used to invoke the utility. 60.Pp 61Collisions have now been produced for MD5, and are theorized for SHA-1, 62so their use is deprecated. 63.Pp 64The options for use with each command are as follows: 65.Bl -tag -width Ds 66.It Fl b 67Output checksums in base64 notation, not hexadecimal. 68.It Fl C Ar checklist 69Compare the checksum of each 70.Ar file 71against the checksums in the 72.Ar checklist . 73Any specified 74.Ar file 75that is not listed in the 76.Ar checklist 77will generate an error. 78.It Fl c 79If this option is specified, the 80.Ar file 81options become checklists. 82Each checklist should contain hash results in the normal format, 83which will be verified against the specified paths. 84Output consists of the digest used, the file name, 85and an OK, FAILED, or MISSING for the result of the comparison. 86This will validate any of the supported checksums (see 87.Xr cksum 1 ) . 88If no file is given, stdin is used. 89.It Fl h Ar hashfile 90Place the checksum into 91.Ar hashfile 92instead of stdout. 93.It Fl p 94Echoes stdin to stdout and appends the 95checksum to stdout. 96.It Fl q 97Only print the checksum (quiet mode). 98.It Fl r 99Reverse the format of the hash algorithm output, making 100it match the output format used by 101.Xr cksum 1 . 102.It Fl s Ar string 103Prints a checksum of the given 104.Ar string . 105.It Fl t 106Runs a built-in time trial. 107Specifying 108.Fl t 109multiple times results in the number of rounds being multiplied 110by 10 for each additional flag. 111.It Fl x 112Runs a built-in test script. 113.El 114.Sh EXIT STATUS 115These utilities exit 0 on success, 116and \*(Gt0 if an error occurs. 117.Sh SEE ALSO 118.Xr cksum 1 119.Sh STANDARDS 120.Rs 121.%A R. Rivest 122.%D April 1992 123.%R RFC 1321 124.%T The MD5 Message-Digest Algorithm 125.Re 126.Rs 127.%A J. Burrows 128.%O FIPS PUB 180-1 129.%T The Secure Hash Standard 130.Re 131.Pp 132.Rs 133.%A D. Eastlake 134.%A P. Jones 135.%D September 2001 136.%R RFC 3174 137.%T US Secure Hash Algorithm 1 (SHA1) 138.Re 139.Rs 140.%T Secure Hash Standard 141.%O FIPS PUB 180-2 142.Re 143.Sh CAVEATS 144Since collisions have been found for MD5, 145the use of 146.Nm sha256 147is recommended instead. 148