xref: /onnv-gate/usr/src/common/openssl/doc/crypto/md5.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948MD2, MD4, MD5, MD2_Init, MD2_Update, MD2_Final, MD4_Init, MD4_Update,
6*2175Sjp161948MD4_Final, MD5_Init, MD5_Update, MD5_Final - MD2, MD4, and MD5 hash functions
7*2175Sjp161948
8*2175Sjp161948=head1 SYNOPSIS
9*2175Sjp161948
10*2175Sjp161948 #include <openssl/md2.h>
11*2175Sjp161948
12*2175Sjp161948 unsigned char *MD2(const unsigned char *d, unsigned long n,
13*2175Sjp161948                  unsigned char *md);
14*2175Sjp161948
15*2175Sjp161948 void MD2_Init(MD2_CTX *c);
16*2175Sjp161948 void MD2_Update(MD2_CTX *c, const unsigned char *data,
17*2175Sjp161948                  unsigned long len);
18*2175Sjp161948 void MD2_Final(unsigned char *md, MD2_CTX *c);
19*2175Sjp161948
20*2175Sjp161948
21*2175Sjp161948 #include <openssl/md4.h>
22*2175Sjp161948
23*2175Sjp161948 unsigned char *MD4(const unsigned char *d, unsigned long n,
24*2175Sjp161948                  unsigned char *md);
25*2175Sjp161948
26*2175Sjp161948 void MD4_Init(MD4_CTX *c);
27*2175Sjp161948 void MD4_Update(MD4_CTX *c, const void *data,
28*2175Sjp161948                  unsigned long len);
29*2175Sjp161948 void MD4_Final(unsigned char *md, MD4_CTX *c);
30*2175Sjp161948
31*2175Sjp161948
32*2175Sjp161948 #include <openssl/md5.h>
33*2175Sjp161948
34*2175Sjp161948 unsigned char *MD5(const unsigned char *d, unsigned long n,
35*2175Sjp161948                  unsigned char *md);
36*2175Sjp161948
37*2175Sjp161948 void MD5_Init(MD5_CTX *c);
38*2175Sjp161948 void MD5_Update(MD5_CTX *c, const void *data,
39*2175Sjp161948                  unsigned long len);
40*2175Sjp161948 void MD5_Final(unsigned char *md, MD5_CTX *c);
41*2175Sjp161948
42*2175Sjp161948=head1 DESCRIPTION
43*2175Sjp161948
44*2175Sjp161948MD2, MD4, and MD5 are cryptographic hash functions with a 128 bit output.
45*2175Sjp161948
46*2175Sjp161948MD2(), MD4(), and MD5() compute the MD2, MD4, and MD5 message digest
47*2175Sjp161948of the B<n> bytes at B<d> and place it in B<md> (which must have space
48*2175Sjp161948for MD2_DIGEST_LENGTH == MD4_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16
49*2175Sjp161948bytes of output). If B<md> is NULL, the digest is placed in a static
50*2175Sjp161948array.
51*2175Sjp161948
52*2175Sjp161948The following functions may be used if the message is not completely
53*2175Sjp161948stored in memory:
54*2175Sjp161948
55*2175Sjp161948MD2_Init() initializes a B<MD2_CTX> structure.
56*2175Sjp161948
57*2175Sjp161948MD2_Update() can be called repeatedly with chunks of the message to
58*2175Sjp161948be hashed (B<len> bytes at B<data>).
59*2175Sjp161948
60*2175Sjp161948MD2_Final() places the message digest in B<md>, which must have space
61*2175Sjp161948for MD2_DIGEST_LENGTH == 16 bytes of output, and erases the B<MD2_CTX>.
62*2175Sjp161948
63*2175Sjp161948MD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and
64*2175Sjp161948MD5_Final() are analogous using an B<MD4_CTX> and B<MD5_CTX> structure.
65*2175Sjp161948
66*2175Sjp161948Applications should use the higher level functions
67*2175Sjp161948L<EVP_DigestInit(3)|EVP_DigestInit(3)>
68*2175Sjp161948etc. instead of calling the hash functions directly.
69*2175Sjp161948
70*2175Sjp161948=head1 NOTE
71*2175Sjp161948
72*2175Sjp161948MD2, MD4, and MD5 are recommended only for compatibility with existing
73*2175Sjp161948applications. In new applications, SHA-1 or RIPEMD-160 should be
74*2175Sjp161948preferred.
75*2175Sjp161948
76*2175Sjp161948=head1 RETURN VALUES
77*2175Sjp161948
78*2175Sjp161948MD2(), MD4(), and MD5() return pointers to the hash value.
79*2175Sjp161948
80*2175Sjp161948MD2_Init(), MD2_Update(), MD2_Final(), MD4_Init(), MD4_Update(),
81*2175Sjp161948MD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() do not return
82*2175Sjp161948values.
83*2175Sjp161948
84*2175Sjp161948=head1 CONFORMING TO
85*2175Sjp161948
86*2175Sjp161948RFC 1319, RFC 1320, RFC 1321
87*2175Sjp161948
88*2175Sjp161948=head1 SEE ALSO
89*2175Sjp161948
90*2175Sjp161948L<sha(3)|sha(3)>, L<ripemd(3)|ripemd(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)>
91*2175Sjp161948
92*2175Sjp161948=head1 HISTORY
93*2175Sjp161948
94*2175Sjp161948MD2(), MD2_Init(), MD2_Update() MD2_Final(), MD5(), MD5_Init(),
95*2175Sjp161948MD5_Update() and MD5_Final() are available in all versions of SSLeay
96*2175Sjp161948and OpenSSL.
97*2175Sjp161948
98*2175Sjp161948MD4(), MD4_Init(), and MD4_Update() are available in OpenSSL 0.9.6 and
99*2175Sjp161948above.
100*2175Sjp161948
101*2175Sjp161948=cut
102