import libcrypto (LibreSSL 2.5.2)
[unleashed.git] / lib / libcrypto / man / MD5.3
blob1f5fe37ef9baee7caa8d563165891ec52e8824fa
1 .\"     $OpenBSD: MD5.3,v 1.4 2016/11/27 16:20:15 schwarze Exp $
2 .\"     OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3 .\"
4 .\" This file was written by Ulf Moeller <ulf@openssl.org> and
5 .\" Richard Levitte <levitte@openssl.org>.
6 .\" Copyright (c) 2000, 2006 The OpenSSL Project.  All rights reserved.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\"
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\"
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\"    notice, this list of conditions and the following disclaimer in
17 .\"    the documentation and/or other materials provided with the
18 .\"    distribution.
19 .\"
20 .\" 3. All advertising materials mentioning features or use of this
21 .\"    software must display the following acknowledgment:
22 .\"    "This product includes software developed by the OpenSSL Project
23 .\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 .\"
25 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 .\"    endorse or promote products derived from this software without
27 .\"    prior written permission. For written permission, please contact
28 .\"    openssl-core@openssl.org.
29 .\"
30 .\" 5. Products derived from this software may not be called "OpenSSL"
31 .\"    nor may "OpenSSL" appear in their names without prior written
32 .\"    permission of the OpenSSL Project.
33 .\"
34 .\" 6. Redistributions of any form whatsoever must retain the following
35 .\"    acknowledgment:
36 .\"    "This product includes software developed by the OpenSSL Project
37 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 .\"
39 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
51 .\"
52 .Dd $Mdocdate: November 27 2016 $
53 .Dt MD5 3
54 .Os
55 .Sh NAME
56 .Nm MD2 ,
57 .Nm MD4 ,
58 .Nm MD5 ,
59 .Nm MD2_Init ,
60 .Nm MD2_Update ,
61 .Nm MD2_Final ,
62 .Nm MD4_Init ,
63 .Nm MD4_Update ,
64 .Nm MD4_Final ,
65 .Nm MD5_Init ,
66 .Nm MD5_Update ,
67 .Nm MD5_Final
68 .Nd MD2, MD4, and MD5 hash functions
69 .Sh SYNOPSIS
70 .In openssl/md2.h
71 .Ft unsigned char *
72 .Fo MD2
73 .Fa "const unsigned char *d"
74 .Fa "unsigned long n"
75 .Fa "unsigned char *md"
76 .Fc
77 .Ft int
78 .Fo MD2_Init
79 .Fa "MD2_CTX *c"
80 .Fc
81 .Ft int
82 .Fo MD2_Update
83 .Fa "MD2_CTX *c"
84 .Fa "const unsigned char *data"
85 .Fa "unsigned long len"
86 .Fc
87 .Ft int
88 .Fo MD2_Final
89 .Fa "unsigned char *md"
90 .Fa "MD2_CTX *c"
91 .Fc
92 .In openssl/md4.h
93 .Ft unsigned char *
94 .Fo MD4
95 .Fa "const unsigned char *d"
96 .Fa "unsigned long n"
97 .Fa "unsigned char *md"
98 .Fc
99 .Ft int
100 .Fo MD4_Init
101 .Fa "MD4_CTX *c"
103 .Ft int
104 .Fo MD4_Update
105 .Fa "MD4_CTX *c"
106 .Fa "const void *data"
107 .Fa "unsigned long len"
109 .Ft int
110 .Fo MD4_Final
111 .Fa "unsigned char *md"
112 .Fa "MD4_CTX *c"
114 .In openssl/md5.h
115 .Ft unsigned char *
116 .Fo MD5
117 .Fa "const unsigned char *d"
118 .Fa "unsigned long n"
119 .Fa "unsigned char *md"
121 .Ft int
122 .Fo MD5_Init
123 .Fa "MD5_CTX *c"
125 .Ft int
126 .Fo MD5_Update
127 .Fa "MD5_CTX *c"
128 .Fa "const void *data"
129 .Fa "unsigned long len"
131 .Ft int
132 .Fo MD5_Final
133 .Fa "unsigned char *md"
134 .Fa "MD5_CTX *c"
136 .Sh DESCRIPTION
137 MD2, MD4, and MD5 are cryptographic hash functions with a 128-bit
138 output.
140 .Fn MD2 ,
141 .Fn MD4 ,
143 .Fn MD5
144 compute the MD2, MD4, and MD5 message digest of the
145 .Fa n
146 bytes at
147 .Fa d
148 and place it in
149 .Fa md ,
150 which must have space for
151 .Dv MD2_DIGEST_LENGTH No ==
152 .Dv MD4_DIGEST_LENGTH No ==
153 .Dv MD5_DIGEST_LENGTH No == 16
154 bytes of output.
156 .Fa md
158 .Dv NULL ,
159 the digest is placed in a static array.
161 The following functions may be used if the message is not completely
162 stored in memory:
164 .Fn MD2_Init
165 initializes a
166 .Vt MD2_CTX
167 structure.
169 .Fn MD2_Update
170 can be called repeatedly with chunks of the message to be hashed
171 .Pq Fa len No bytes at Fa data .
173 .Fn MD2_Final
174 places the message digest in
175 .Fa md ,
176 which must have space for
177 .Dv MD2_DIGEST_LENGTH No == 16
178 bytes of output, and erases the
179 .Vt MD2_CTX .
181 .Fn MD4_Init ,
182 .Fn MD4_Update ,
183 .Fn MD4_Final ,
184 .Fn MD5_Init ,
185 .Fn MD5_Update ,
187 .Fn MD5_Final
188 are analogous using an
189 .Vt MD4_CTX
191 .Vt MD5_CTX
192 structure.
194 Applications should use the higher level functions
195 .Xr EVP_DigestInit 3
196 etc. instead of calling these hash functions directly.
197 .Sh RETURN VALUES
198 .Fn MD2 ,
199 .Fn MD4 ,
201 .Fn MD5
202 return pointers to the hash value.
204 .Fn MD2_Init ,
205 .Fn MD2_Update ,
206 .Fn MD2_Final ,
207 .Fn MD4_Init ,
208 .Fn MD4_Update ,
209 .Fn MD4_Final ,
210 .Fn MD5_Init ,
211 .Fn MD5_Update ,
213 .Fn MD5_Final
214 return 1 for success or 0 otherwise.
215 .Sh SEE ALSO
216 .Xr EVP_DigestInit 3
217 .Sh STANDARDS
218 RFC 1319, RFC 1320, RFC 1321
219 .Sh HISTORY
220 .Fn MD2 ,
221 .Fn MD2_Init ,
222 .Fn MD2_Update ,
223 .Fn MD2_Final ,
224 .Fn MD5 ,
225 .Fn MD5_Init ,
226 .Fn MD5_Update ,
228 .Fn MD5_Final
229 are available in all versions of SSLeay and OpenSSL.
231 .Fn MD4 ,
232 .Fn MD4_Init ,
234 .Fn MD4_Update
235 are available in OpenSSL 0.9.6 and above.