1.\" 2.\" ---------------------------------------------------------------------------- 3.\" "THE BEER-WARE LICENSE" (Revision 42): 4.\" <phk@login.dkuug.dk> 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.\" ---------------------------------------------------------------------------- 8.\" |
9.\" $FreeBSD: head/lib/libmd/mdX.3 9488 1995-07-12 09:13:49Z phk $ |
10.\" 11.Dd July 14, 1994 12.Dt MDX 3 13.Os FreeBSD 2 14.Sh NAME 15.Nm MDXInit , 16.Nm MDXUpdate , 17.Nm MDXFinal , --- 5 unchanged lines hidden (view full) --- 23.Fd #include <mdX.h> 24.Ft void 25.Fn MDXInit "MDX_CTX *context" 26.Ft void 27.Fn MDXUpdate "MDX_CTX *context" "unsigned char *data" "unsigned int len" 28.Ft void 29.Fn MDXFinal "unsigned char digest[16]" "MDX_CTX *context" 30.Ft "char *" |
31.Fn MDXEnd "MDX_CTX *context" "char *buf" |
32.Ft "char *" |
33.Fn MDXFile "char *filename" "char *buf" |
34.Ft "char *" |
35.Fn MDXData "unsigned char *data" "unsigned int len" "char *buf" |
36.Sh DESCRIPTION 37The MDX functions calculate a 128-bit cryptographic checksum (digest) 38for any number of input bytes. A cryptographic checksum is a one-way 39hash-function, that is, you cannot find (except by exhaustive search) 40the input corresponding to a particular output. This net result is 41a ``fingerprint'' of the input-data, which doesn't disclose the actual 42input. 43 --- 10 unchanged lines hidden (view full) --- 54functions are the core functions. Allocate a MDX_CTX, initialize it with 55.Fn MDXInit 56run over the data with 57.Fn MDXUpdate 58and finally extract the result using 59.Fn MDXFinal . 60 61.Fn MDXEnd |
62is a wrapper for |
63.Fn MDXFinal , |
64which converts the return value to a 33 character (incl terminating NULL) 65ascii string which represents the 128 bits in hexadecimal. |
66 67.Fn MDXFile |
68calculates the digest of a file, and uses 69.Fn MDXFinal 70to return the result. |
71In case the file cannot be opened, NULL is returned. 72 73.Fn MDXData |
74calculates the digest of a chunk of data in memory, and uses 75.Fn MDXFinal 76to return the result. |
77 78When using 79.Fn MDXEnd , 80.Fn MDXFile |
81or |
82.Fn MDXData , |
83the 84.Ar buf 85argument can be NULL, in which case the returned string is allocated with 86.Xr malloc 3 87and subsequently must be explicitly deallocated using |
88.Xr free 3 89after use. |
90If the 91.Ar buf 92argument isn't NULL it must point to at least 33 characters of buffer space. |
93.Sh SEE ALSO 94.Xr md2 3 , 95.Xr md4 3 , 96.Xr md5 3 97.Pp 98ISOC 99Internet Request For Comments 100.%T RFC1319 , --- 14 unchanged lines hidden (view full) --- 115.Sh HISTORY 116These functions appeared in 117.Em FreeBSD-2.0 118.Sh BUGS 119No method is known to exist which finds two files having the same hash value, 120nor to find a file with a specific hash value. 121There is on the other hand no guarantee that such a method doesn't exist. 122 |
123MD2 has only been released for use in Privacy Enhanced eMail. |
124Use MD4 or MD5 if that isn't what you're doing. 125.Sh COPYRIGHT |