2 .\" ----------------------------------------------------------------------------
3 .\" "THE BEER-WARE LICENSE" (Revision 42):
4 .\" <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
5 .\" can do whatever you want with this stuff. If we meet some day, and you think
6 .\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 .\" ----------------------------------------------------------------------------
23 .Nd calculate the RSA Data Security, Inc., ``MDX'' message digest
30 .Fn MDXInit "MDX_CTX *context"
32 .Fn MDXUpdate "MDX_CTX *context" "const void *data" "unsigned int len"
34 .Fn MDXPad "MDX_CTX *context"
36 .Fn MDXFinal "unsigned char digest[16]" "MDX_CTX *context"
38 .Fn MDXEnd "MDX_CTX *context" "char *buf"
40 .Fn MDXFd "int fd" "char *buf"
42 .Fn MDXFdChunk "int fd" "char *buf" "off_t offset" "off_t length"
44 .Fn MDXFile "const char *filename" "char *buf"
46 .Fn MDXFileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
48 .Fn MDXData "const void *data" "unsigned int len" "char *buf"
50 The MDX functions calculate a 128-bit cryptographic checksum (digest)
51 for any number of input bytes.
52 A cryptographic checksum is a one-way
53 hash-function, that is, you cannot find (except by exhaustive search)
54 the input corresponding to a particular output.
57 of the input-data, which does not disclose the actual input.
59 MD4 is the fastest and MD5 is somewhat slower.
60 MD4 has now been broken; it should only be used where necessary for
61 backward compatibility.
62 MD5 has not yet (1999-02-11) been broken, but sufficient attacks have been
63 made that its security is in some doubt.
64 The attacks on both MD4 and MD5
65 are both in the nature of finding
69 inputs which hash to the same value; it is still unlikely for an attacker
70 to be able to determine the exact original input given a hash value.
77 functions are the core functions.
82 run over the data with
84 and finally extract the result using
86 which will also erase the
91 function can be used to pad message data in same way
94 without terminating calculation.
98 function is a wrapper for
100 which converts the return value to a 33-character
101 (including the terminating '\e0')
102 ASCII string which represents the 128 bits in hexadecimal.
106 function calculates the digest of a file, and uses
108 to return the result.
109 If the file cannot be opened, a null pointer is returned.
112 function is similar to
114 but it only calculates the digest over a byte-range of the file specified,
122 parameter is specified as 0, or more than the length of the remaining part
125 calculates the digest from
130 function calculates the digest of a chunk of data in memory, and uses
132 to return the result.
138 functions are identical to their
142 counterparts, with the exception that the first argument is an
154 argument can be a null pointer, in which case the returned string
157 and subsequently must be explicitly deallocated using
162 argument is non-null it must point to at least 33 characters of buffer space.
166 function called with a null buf argument may fail and return NULL if:
169 Insufficient storage space is available.
176 may return NULL when underlying
193 .%T The MD4 Message-Digest Algorithm
198 .%T The MD5 Message-Digest Algorithm
210 .%T On Recent Results for MD2, MD4 and MD5
211 .%J RSA Laboratories Bulletin
213 .%D November 12, 1996
216 These functions appeared in
219 The original MDX routines were developed by
220 RSA Data Security, Inc., and published in the above references.
221 This code is derived directly from these implementations by
222 .An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
226 The MD5 algorithm has been proven to be vulnerable to practical collision
227 attacks and should not be relied upon to produce unique outputs,
228 .Em nor should they be used as part of a cryptographic signature scheme.