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 .\" ----------------------------------------------------------------------------
21 .Nd calculate the RSA Data Security, Inc., ``MDX'' message digest
28 .Fn MDXInit "MDX_CTX *context"
30 .Fn MDXUpdate "MDX_CTX *context" "const void *data" "unsigned int len"
32 .Fn MDXPad "MDX_CTX *context"
34 .Fn MDXFinal "unsigned char digest[16]" "MDX_CTX *context"
36 .Fn MDXEnd "MDX_CTX *context" "char *buf"
38 .Fn MDXFile "const char *filename" "char *buf"
40 .Fn MDXFileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
42 .Fn MDXData "const void *data" "unsigned int len" "char *buf"
44 The MDX functions calculate a 128-bit cryptographic checksum (digest)
45 for any number of input bytes.
46 A cryptographic checksum is a one-way
47 hash-function, that is, you cannot find (except by exhaustive search)
48 the input corresponding to a particular output.
51 of the input-data, which does not disclose the actual input.
53 MD4 is the fastest and MD5 is somewhat slower.
54 MD4 has now been broken; it should only be used where necessary for
55 backward compatibility.
56 MD5 has not yet (1999-02-11) been broken, but sufficient attacks have been
57 made that its security is in some doubt.
58 The attacks on both MD4 and MD5
59 are both in the nature of finding
63 inputs which hash to the same value; it is still unlikely for an attacker
64 to be able to determine the exact original input given a hash value.
71 functions are the core functions.
76 run over the data with
78 and finally extract the result using
80 which will also erase the
85 function can be used to pad message data in same way
88 without terminating calculation.
92 function is a wrapper for
94 which converts the return value to a 33-character
95 (including the terminating '\e0')
96 ASCII string which represents the 128 bits in hexadecimal.
100 function calculates the digest of a file, and uses
102 to return the result.
103 If the file cannot be opened, a null pointer is returned.
106 function is similar to
108 but it only calculates the digest over a byte-range of the file specified,
116 parameter is specified as 0, or more than the length of the remaining part
119 calculates the digest from
124 function calculates the digest of a chunk of data in memory, and uses
126 to return the result.
135 argument can be a null pointer, in which case the returned string
138 and subsequently must be explicitly deallocated using
143 argument is non-null it must point to at least 33 characters of buffer space.
147 function called with a null buf argument may fail and return NULL if:
150 Insufficient storage space is available.
157 may return NULL when underlying
174 .%T The MD4 Message-Digest Algorithm
179 .%T The MD5 Message-Digest Algorithm
191 .%T On Recent Results for MD2, MD4 and MD5
192 .%J RSA Laboratories Bulletin
194 .%D November 12, 1996
197 These functions appeared in
200 The original MDX routines were developed by
201 RSA Data Security, Inc., and published in the above references.
202 This code is derived directly from these implementations by
203 .An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
207 The MD5 algorithm has been proven to be vulnerable to practical collision
208 attacks and should not be relied upon to produce unique outputs,
209 .Em nor should they be used as part of a cryptographic signature scheme.