xref: /freebsd/sbin/md5/md5.1 (revision 1f4bcc459a76b7aa664f3fd557684cd0ba6da352)
1.\" $FreeBSD$
2.Dd October 17, 2015
3.Dt MD5 1
4.Os
5.Sh NAME
6.Nm md5 , sha1 , sha256 , sha384 , sha512, rmd160
7.Nd calculate a message-digest fingerprint (checksum) for a file
8.Sh SYNOPSIS
9.Nm md5
10.Op Fl pqrtx
11.Op Fl c Ar string
12.Op Fl s Ar string
13.Op Ar
14.Nm sha1
15.Op Fl pqrtx
16.Op Fl c Ar string
17.Op Fl s Ar string
18.Op Ar
19.Nm sha256
20.Op Fl pqrtx
21.Op Fl c Ar string
22.Op Fl s Ar string
23.Op Ar
24.Nm sha384
25.Op Fl pqrtx
26.Op Fl c Ar string
27.Op Fl s Ar string
28.Op Ar
29.Nm sha512
30.Op Fl pqrtx
31.Op Fl c Ar string
32.Op Fl s Ar string
33.Op Ar
34.Nm rmd160
35.Op Fl pqrtx
36.Op Fl c Ar string
37.Op Fl s Ar string
38.Op Ar
39.Sh DESCRIPTION
40The
41.Nm md5 , sha1 , sha256 , sha384 , sha512
42and
43.Nm rmd160
44utilities take as input a message of arbitrary length and produce as
45output a
46.Dq fingerprint
47or
48.Dq message digest
49of the input.
50It is conjectured that it is computationally infeasible to
51produce two messages having the same message digest, or to produce any
52message having a given prespecified target message digest.
53The
54.Tn MD5 , SHA-1 , SHA-256 , SHA-384 , SHA-512
55and
56.Tn RIPEMD-160
57algorithms are intended for digital signature applications, where a
58large file must be
59.Dq compressed
60in a secure manner before being encrypted with a private
61(secret)
62key under a public-key cryptosystem such as
63.Tn RSA .
64.Pp
65.Tn MD5
66has been completely broken as far as finding collisions is
67concerned, and should not be relied upon to produce unique outputs.
68This also means that
69.Tn MD5
70should not be used as part of a cryptographic signature scheme.
71At the current time (2014-05-17) there is no publicly known method to
72.Dq reverse
73MD5, i.e., to find an input given a hash value.
74.Pp
75.Tn SHA-1
76currently (2014-05-17) has no known collisions, but an attack has been
77found which is faster than a brute-force search, placing the security of
78.Tn SHA-1
79in doubt.
80.Pp
81It is recommended that all new applications use
82.Tn SHA-256
83instead of one of the other hash functions.
84.Pp
85The following options may be used in any combination and must
86precede any files named on the command line.
87The hexadecimal checksum of each file listed on the command line is printed
88after the options are processed.
89.Bl -tag -width indent
90.It Fl c Ar string
91Compare the digest of the file against this string.
92.Pq Note that this option is not yet useful if multiple files are specified.
93.It Fl s Ar string
94Print a checksum of the given
95.Ar string .
96.It Fl p
97Echo stdin to stdout and append the checksum to stdout.
98.It Fl q
99Quiet mode \(em only the checksum is printed out.
100Overrides the
101.Fl r
102option.
103.It Fl r
104Reverses the format of the output.
105This helps with visual diffs.
106Does nothing
107when combined with the
108.Fl ptx
109options.
110.It Fl t
111Run a built-in time trial.
112.It Fl x
113Run a built-in test script.
114.El
115.Sh EXIT STATUS
116The
117.Nm md5 , sha1 , sha256 , sha512
118and
119.Nm rmd160
120utilities exit 0 on success,
1211 if at least one of the input files could not be read,
122and 2 if at least one file does not have the same hash as the
123.Fl c
124option.
125.Sh SEE ALSO
126.Xr cksum 1 ,
127.Xr md5 3 ,
128.Xr ripemd 3 ,
129.Xr sha 3 ,
130.Xr sha256 3 ,
131.Xr sha384 3 ,
132.Xr sha512 3
133.Rs
134.%A R. Rivest
135.%T The MD5 Message-Digest Algorithm
136.%O RFC1321
137.Re
138.Rs
139.%A J. Burrows
140.%T The Secure Hash Standard
141.%O FIPS PUB 180-2
142.Re
143.Rs
144.%A D. Eastlake and P. Jones
145.%T US Secure Hash Algorithm 1
146.%O RFC 3174
147.Re
148.Pp
149RIPEMD-160 is part of the ISO draft standard
150.Qq ISO/IEC DIS 10118-3
151on dedicated hash functions.
152.Pp
153Secure Hash Standard (SHS):
154.Pa http://csrc.nist.gov/cryptval/shs.html .
155.Pp
156The RIPEMD-160 page:
157.Pa http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html .
158.Sh ACKNOWLEDGMENTS
159This program is placed in the public domain for free general use by
160RSA Data Security.
161.Pp
162Support for SHA-1 and RIPEMD-160 has been added by
163.An Oliver Eikemeier Aq Mt eik@FreeBSD.org .
164