1.Dd April 5, 2007
2.Dt CC_MD5 3cc
3.Os
4.Sh NAME
5.Nm CC_MD2_Init
6.Nm CC_MD2_Update
7.Nm CC_MD2_Final
8.Nm CC_MD2
9.Pp
10.Nm CC_MD4_Init
11.Nm CC_MD4_Update
12.Nm CC_MD4_Final
13.Nm CC_MD4
14.Pp
15.Nm CC_MD5_Init
16.Nm CC_MD5_Update
17.Nm CC_MD5_Final
18.Nm CC_MD5
19.Pp
20.Nd MD2, MD4, and MD5 hash functions
21.Sh SYNOPSIS
22.In CommonCrypto/CommonDigest.h
23.Ft extern int
24.Fn CC_MD2_Init "CC_MD2_CTX *c"
25.Ft extern int
26.Fn CC_MD2_Update "CC_MD2_CTX *c" "const void *data" "CC_LONG len"
27.Ft extern int
28.Fn CC_MD2_Final "unsigned char *md" "CC_MD2_CTX *c"
29.Ft extern unsigned char *
30.Fn CC_MD2 "const void *data" "CC_LONG len" "unsigned char *md"
31.Pp
32.Ft extern int
33.Fn CC_MD4_Init "CC_MD4_CTX *c"
34.Ft extern int
35.Fn CC_MD4_Update "CC_MD4_CTX *c" "const void *data" "CC_LONG len"
36.Ft extern int
37.Fn CC_MD4_Final "unsigned char *md" "CC_MD4_CTX *c"
38.Ft extern unsigned char *
39.Fn CC_MD4 "const void *data" "CC_LONG len" "unsigned char *md"
40.Pp
41.Ft extern int
42.Fn CC_MD5_Init "CC_MD5_CTX *c"
43.Ft extern int
44.Fn CC_MD5_Update "CC_MD5_CTX *c" "const void *data" "CC_LONG len"
45.Ft extern int
46.Fn CC_MD5_Final "unsigned char *md" "CC_MD5_CTX *c"
47.Ft extern unsigned char *
48.Fn CC_MD5 "const void *data" "CC_LONG len" "unsigned char *md"
49.Sh DESCRIPTION
50The following functions are used to produce an hash from data:
51.Pp
52.Fn CC_MD2_Init
53initializes a 
54.Ft CC_MD2_CTX
55structure.
56.Pp
57.Fn CC_MD2_Update
58can be called repeatedly with chunks of the message to
59be hashed (len bytes at data).
60.Pp
61.Fn CC_MD2_Final
62places the MD2 message digest in md, which must have space
63for 
64.Ft CC_MD2_DIGEST_LENGTH
65== 16 bytes of output, and erases the 
66.Ft CC_MD2_CTX .
67.Pp
68.Fn CC_MD2
69computes the MD2 message digest of the len
70bytes at data and places it in md (which must have space for
71.Ft CC_MD2_DIGEST_LENGTH
72== 16 bytes of output). It returns the md pointer.
73.Pp
74.Fn CC_MD4_Init , 
75.Fn CC_MD4_Update , 
76.Fn CC_MD4_Final , 
77.Fn CC_MD4 , 
78.Fn CC_MD5_Init , 
79.Fn CC_MD5_Update , 
80.Fn CC_MD5_Final ,
81and 
82.Fn CC_MD5
83are analogous using an 
84.Ft CC_MD4_CTX
85and 
86.Ft CC_MD5_CTX
87structure.
88.Sh NOTE
89MD2, MD4, and MD5 are recommended only for compatibility with existing
90applications. In new applications, SHA\-256(or greater) should be
91preferred.
92.Sh RETURN VALUES
93All routines return 1 except for the one-shot routines (
94.Fn CC_MD2
95, etc.), which return the pointer passed in via the md parameter.
96.Sh CONFORMING TO
97RFC 1319, RFC 1320, RFC 1321
98.Sh SEE ALSO
99.Xr CC_crypto 3cc ,
100.Xr CC_SHA 3cc ,
101.Xr CCHmac 3cc ,
102.Xr CCCryptor 3cc
103.Sh HISTORY
104These functions are available in OS X 10.4 and later.
105.Pp
106These functions provide similar functionality to the routines found
107in OpenSSL 0.9.6 and may use the same implementation.
108