xref: /dragonfly/sbin/md5/md5.1 (revision e4adeac1)
1.\" $FreeBSD: src/sbin/md5/md5.1,v 1.24 2005/03/10 09:56:39 cperciva Exp $
2.Dd January 9, 2021
3.Dt MD5 1
4.Os
5.Sh NAME
6.Nm md5 ,
7.Nm sha1 ,
8.Nm sha256 ,
9.Nm sha512 ,
10.Nm rmd160
11.Nd calculate a message-digest fingerprint (checksum) for a file
12.Sh SYNOPSIS
13.Nm md5
14.Op Fl pqrtx
15.Op Fl b Ar offset
16.Op Fl e Ar offset
17.Op Fl s Ar string
18.Op Ar
19.Nm sha1
20.Op Fl pqrtx
21.Op Fl b Ar offset
22.Op Fl e Ar offset
23.Op Fl s Ar string
24.Op Ar
25.Nm sha256
26.Op Fl pqrtx
27.Op Fl b Ar offset
28.Op Fl e Ar offset
29.Op Fl s Ar string
30.Op Ar
31.Nm rmd160
32.Op Fl pqrtx
33.Op Fl b Ar offset
34.Op Fl e Ar offset
35.Op Fl s Ar string
36.Op Ar
37.Sh DESCRIPTION
38The
39.Nm md5 ,
40.Nm sha1 ,
41.Nm sha256 ,
42.Nm sha512
43and
44.Nm rmd160
45utilities take as input a message of arbitrary length and produce as
46output a
47.Dq fingerprint
48or
49.Dq message digest
50of the input.
51It is conjectured that it is computationally infeasible to
52produce two messages having the same message digest, or to produce any
53message having a given prespecified target message digest.
54The
55.Tn MD5 , SHA-1, SHA-256, SHA-512
56and
57.Tn RIPEMD-160
58algorithms are intended for digital signature applications, where a
59large file must be
60.Dq compressed
61in a secure manner before being encrypted with a private
62(secret)
63key under a public-key cryptosystem such as
64.Tn RSA .
65.Pp
66The
67.Tn MD5
68and
69.Tn SHA-1
70algorithms are vulnerable to practical collision attacks.
71.Pp
72The following options may be used in any combination and must
73precede any files named on the command line.
74The hexadecimal checksum of each file listed on the command line is printed
75after the options are processed.
76.Bl -tag -width indent
77.It Fl b Ar offset
78When processing file(s), use the specified begin and/or end (below) instead
79of processing each file in its entirety.
80Either option can be omitted.
81Both begin- and end-offsets can be specified as just a number (of bytes) or
82be followed by K, M, or G to mean that the number is to be multiplied by
831024 once, twice, or thrice respectively.
84For example, to start at 512, you can use
85.Fl b Ar 512
86or
87.Fl b Ar 0.5K .
88.Pp
89The use of offsets is implemented using
90.Fn mmap
91and will only work on regular files and mmap-able devices.
92.Pp
93If the beginning offset is negative, its absolute value is subtracted
94from the file's size.
95Zero thus means the very beginning of each file,
96which is also the default if the option is omitted entirely.
97.It Fl e Ar offset
98If the end-offset is not positive, its absolute value is subtracted
99from the file's size.
100Zero thus means the very end of each file,
101which is also the default if the option is omitted entirely.
102.It Fl s Ar string
103Print a checksum of the given
104.Ar string .
105.It Fl p
106Echo stdin to stdout and append the checksum to stdout.
107.It Fl q
108Quiet mode \(em only the checksum is printed out.
109Overrides the
110.Fl r
111option.
112.It Fl r
113Reverses the format of the output.
114This helps with visual diffs.
115Does nothing
116when combined with the
117.Fl ptx
118options.
119.It Fl t
120Run a built-in time trial.
121.It Fl x
122Run a built-in test script.
123.El
124.Sh EXIT STATUS
125The
126.Nm md5 ,
127.Nm sha1 ,
128.Nm sha256 ,
129.Nm sha512
130and
131.Nm rmd160
132utilities exit 0 on success, and
133.Dv EX_NOINPUT Pq 66
134if at least one of the input files could not be read or
135invalid offsets were specified.
136A mistake with command line arguments results in
137.Dv EX_USAGE Pq 64 .
138.Sh SEE ALSO
139.Xr cksum 1 ,
140.Xr mmap 2
141.Rs
142.%A R. Rivest
143.%T The MD5 Message-Digest Algorithm
144.%O RFC 1321
145.Re
146.Rs
147.%A J. Burrows
148.%T The Secure Hash Standard
149.%O FIPS PUB 180-1
150.Re
151.Rs
152.%A D. Eastlake and P. Jones
153.%T US Secure Hash Algorithm 1
154.%O RFC 3174
155.Re
156.Pp
157RIPEMD-160 is part of the ISO draft standard
158.Qq ISO/IEC DIS 10118-3
159on dedicated hash functions.
160.Pp
161Secure Hash Standard (SHS):
162.Pa http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf .
163.Pp
164The RIPEMD-160 page:
165.Pa http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html .
166.Sh ACKNOWLEDGMENTS
167This program is placed in the public domain for free general use by
168RSA Data Security.
169.Pp
170Support for SHA-1 and RIPEMD-160 has been added by
171.An Oliver Eikemeier Aq Mt eik@FreeBSD.org .
172