xref: /openbsd/bin/md5/md5.1 (revision 80461f24)
1.\"	$OpenBSD: md5.1,v 1.50 2023/10/31 20:42:14 millert Exp $
2.\"
3.\" Copyright (c) 2003, 2004, 2006 Todd C. Miller <millert@openbsd.org>
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: October 31 2023 $
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.
58.Pp
59Two messages having the same message digest (a collision) have been produced
60for MD5 and for SHA-1, so their use is deprecated.
61.Pp
62The options for use with each command are as follows:
63.Bl -tag -width Ds
64.It Fl b
65Output checksums in base64 notation, not hexadecimal.
66.It Fl C Ar checklist
67Compare the checksum of each
68.Ar file
69against the checksums in the
70.Ar checklist .
71Any specified
72.Ar file
73that is not listed in the
74.Ar checklist
75will generate an error.
76.It Fl c
77If this option is specified, the
78.Ar file
79options become checklists.
80Each checklist should contain hash results, which will be verified
81against the specified paths.
82Both normal (BSD) and reverse (GNU) forms are supported in either
83hexadecimal or base64 format.
84Output consists of the digest used, the file name,
85and an OK, FAILED, or MISSING for the result of the comparison.
86Entries in normal format can be validated using any of the supported checksums
87(see
88.Xr cksum 1 ) .
89Entries in reverse format are validated using the default algorithm.
90If no file is given, stdin is used.
91.It Fl h Ar hashfile
92Place the checksum into
93.Ar hashfile
94instead of stdout.
95.It Fl p
96Echo stdin to stdout and append the
97checksum to stdout.
98.It Fl q
99Only print the checksum (quiet mode) or if used in conjunction with the
100.Fl c
101flag, only print the failed cases.
102.It Fl r
103Reverse the format of the hash algorithm output, similar to
104the output format used by
105.Xr cksum 1
106(but without the number of octets).
107This is also the format used by the GNU
108.Xr cksum 1
109utility.
110.It Fl s Ar string
111Print a checksum of the given
112.Ar string .
113.It Fl t
114Run a built-in time trial.
115Specifying
116.Fl t
117multiple times results in the number of rounds being multiplied
118by 10 for each additional flag.
119.It Fl x
120Run a built-in test script.
121.El
122.Sh EXIT STATUS
123These utilities exit 0 on success,
124and \*(Gt0 if an error occurs.
125.Sh SEE ALSO
126.Xr cksum 1
127.Sh STANDARDS
128.Rs
129.%A R. Rivest
130.%D April 1992
131.%R RFC 1321
132.%T The MD5 Message-Digest Algorithm
133.Re
134.Rs
135.%A J. Burrows
136.%O FIPS PUB 180-1
137.%T The Secure Hash Standard
138.Re
139.Pp
140.Rs
141.%A D. Eastlake
142.%A P. Jones
143.%D September 2001
144.%R RFC 3174
145.%T US Secure Hash Algorithm 1 (SHA1)
146.Re
147.Rs
148.%T Secure Hash Standard
149.%O FIPS PUB 180-2
150.Re
151