2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH MD4 3EXT "Nov 13, 2007"
8 md4, MD4Init, MD4Update, MD4Final \- MD4 digest functions
12 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lmd\fR [ \fIlibrary\fR ... ]
15 \fBvoid\fR \fBMD4Init\fR(\fBMD4_CTX *\fR\fIcontext\fR);
20 \fBvoid\fR \fBMD4Update\fR(\fBMD4_CTX *\fR\fIcontext\fR, \fBunsigned char *\fR\fIinput\fR,
21 \fBunsigned int\fR \fIinlen\fR);
26 \fBvoid\fR \fBMD4Final\fR(\fBunsigned char *\fR\fIoutput\fR, \fBMD4_CTX *\fR\fIcontext\fR);
32 The \fBMD4\fR functions implement the \fBMD4\fR message-digest algorithm. The
33 algorithm takes as input a message of arbitrary length and produces a
34 "fingerprint" or "message digest" as output. The \fBMD4\fR message-digest
35 algorithm is intended for digital signature applications in which large files
36 are "compressed" in a secure manner before being encrypted with a private
37 (secret) key under a public-key cryptosystem such as RSA.
38 .SS "\fBMD4Init()\fR, \fBMD4Update()\fR, \fBMD4Final()\fR"
41 The \fBMD4Init()\fR, \fBMD4Update()\fR, and \fBMD4Final()\fR functions allow an
42 \fBMD4\fR digest to be computed over multiple message blocks. Between blocks,
43 the state of the \fBMD4\fR computation is held in an \fBMD4\fR context
44 structure allocated by the caller. A complete digest computation consists of
45 calls to \fBMD4\fR functions in the following order: one call to
46 \fBMD4Init()\fR, one or more calls to \fBMD4Update()\fR, and one call to
50 The \fBMD4Init()\fR function initializes the \fBMD4\fR context structure
51 pointed to by \fIcontext\fR.
54 The \fBMD4Update()\fR function computes a partial \fBMD4\fR digest on the
55 \fIinlen\fR-byte message block pointed to by \fIinput\fR, and updates the
56 \fBMD4\fR context structure pointed to by \fIcontext\fR accordingly.
59 The \fBMD4Final()\fR function generates the final \fBMD4\fR digest, using the
60 \fBMD4\fR context structure pointed to by \fIcontext\fR. The \fBMD4\fR digest
61 is written to output. After a call to \fBMD4Final()\fR, the state of the
62 context structure is undefined. It must be reinitialized with \fBMD4Init()\fR
63 before it can be used again.
67 These functions do not return a value.
71 The \fBMD4\fR digest algorithm is not currently considered cryptographically
72 secure. It is included in \fBlibmd\fR(3LIB) for use by legacy protocols and
73 systems only. It should not be used by new systems or protocols.
76 \fBExample 1 \fRAuthenticate a message found in multiple buffers
79 The following is a sample function that must authenticate a message that is
80 found in multiple buffers. The calling function provides an authentication
81 buffer that will contain the result of the \fBMD4\fR digest.
86 #include <sys/types.h>
91 AuthenticateMsg(unsigned char *auth_buffer, struct iovec
92 *messageIov, unsigned int num_buffers)
99 for(i=0; i<num_buffers; i++)
101 MD4Update(&ctx, messageIov->iov_base,
102 messageIov->iov_len);
103 messageIov += sizeof(struct iovec);
106 MD4Final(auth_buffer, &ctx);
116 See \fBattributes\fR(5) for descriptions of the following attributes:
124 ATTRIBUTE TYPE ATTRIBUTE VALUE
126 Interface Stability Committed