1 .\" $NetBSD: md2.3,v 1.1 2005/09/24 20:51:14 elad Exp $
3 .\" ----------------------------------------------------------------------------
4 .\" "THE BEER-WARE LICENSE" (Revision 42):
5 .\" <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
6 .\" can do whatever you want with this stuff. If we meet some day, and you think
7 .\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
8 .\" ----------------------------------------------------------------------------
10 .\" from FreeBSD Id: mdX.3,v 1.7 1996/10/22 16:28:56 phk Exp
12 .Dd September 24, 2005
22 .Nd calculate the RSA Data Security, Inc.,
31 .Fn MD2Init "MD2_CTX *context"
33 .Fn MD2Update "MD2_CTX *context" "const unsigned char *data" "unsigned int len"
35 .Fn MD2Final "unsigned char digest[16]" "MD2_CTX *context"
37 .Fn MD2End "MD2_CTX *context" "char *buf"
39 .Fn MD2File "const char *filename" "char *buf"
41 .Fn MD2Data "const unsigned char *data" "unsigned int len" "char *buf"
43 The MD2 functions calculate a 128-bit cryptographic checksum (digest)
44 for any number of input bytes.
45 A cryptographic checksum is a one-way
46 hash-function, that is, you cannot find (except by exhaustive search)
47 the input corresponding to a particular output.
49 a ``fingerprint'' of the input-data, which doesn't disclose the actual
52 The MD2 routines should not be used for any security-related purpose.
59 functions are the core functions.
60 Allocate an MD2_CTX, initialize it with
62 run over the data with
64 and finally extract the result using
70 which converts the return value to a 33-character
71 (including the terminating '\e0')
73 string which represents the 128 bits in hexadecimal.
76 calculates the digest of a file, and uses
79 If the file cannot be opened, a null pointer is returned.
81 calculates the digest of a chunk of data in memory, and uses
92 argument can be a null pointer, in which case the returned string
95 and subsequently must be explicitly deallocated using
100 argument is non-null it must point to at least 33 characters of buffer space.
105 .%T The MD2 Message-Digest Algorithm
110 .%T Frequently Asked Questions About today's Cryptography
113 These functions appeared in
116 The original MD2 routines were developed by
118 Data Security, Inc., and published in the above references.
119 This code is a public domain implementation by Andrew Brown.
121 No method is known to exist which finds two files having the same hash value,
122 nor to find a file with a specific hash value.
123 There is on the other hand no guarantee that such a method doesn't exist.