IccMAX 2.1.27
Color Profile Tools
Loading...
Searching...
No Matches
IccMD5.h File Reference
#include "IccProfLibConf.h"
+ Include dependency graph for IccMD5.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  MD5_CTX
 

Typedefs

typedef unsigned char * POINTER
 
typedef unsigned short int UINT2
 
typedef ICCUINT32 UINT4
 

Functions

void ICCPROFLIB_API icMD5Final (unsigned char *, MD5_CTX *)
 
void ICCPROFLIB_API icMD5Init (MD5_CTX *)
 
void ICCPROFLIB_API icMD5Update (MD5_CTX *, unsigned char *, unsigned int)
 

Detailed Description

IccMD5.H - header file for IccMD5.cpp

Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.

License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function.

License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work.

RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind.

These notices must be retained in any copies of any part of this documentation and/or software.

Definition in file IccMD5.h.


Data Structure Documentation

◆ MD5_CTX

struct MD5_CTX

MD5 context.

Data Fields
unsigned char buffer[64]
UINT4 count[2]
UINT4 state[4]

Typedef Documentation

◆ POINTER

typedef unsigned char* POINTER

POINTER defines a generic pointer type

◆ UINT2

typedef unsigned short int UINT2

UINT2 defines a two byte word

◆ UINT4

typedef ICCUINT32 UINT4

UINT4 defines a four byte word

Function Documentation

◆ icMD5Final()

void ICCPROFLIB_API icMD5Final ( unsigned char *  digest,
MD5_CTX context 
)

MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context.

151{
152 unsigned char bits[8];
153 unsigned int index, padLen;
154
155 /* Save number of bits */
156 Encode (bits, context->count, 8);
157
158 /* Pad out to 56 mod 64.
159*/
160 index = (unsigned int)((context->count[0] >> 3) & 0x3f);
161 padLen = (index < 56) ? (56 - index) : (120 - index);
162 icMD5Update (context, PADDING, padLen);
163
164 /* Append length (before padding) */
165 icMD5Update (context, bits, 8);
166
167
168 /* Store state in digest */
169 Encode (digest, context->state, 16);
170
171 /* Zeroize sensitive information.
172*/
173 memset((POINTER)context, 0, sizeof (*context));
174}
unsigned char * POINTER
Definition IccMD5.h:42
static void Encode(unsigned char *, UINT4 *, unsigned int)
Definition IccMD5.cpp:269
void ICCPROFLIB_API icMD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputLen)
Definition IccMD5.cpp:114
static unsigned char PADDING[64]
Definition IccMD5.cpp:56
static const CFAllocatorContext context
Definition RefIccMAXCmm.cpp:1188

References MD5_CTX::count, Encode(), icMD5Update(), PADDING, and MD5_CTX::state.

Referenced by CalcProfileID().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icMD5Init()

void ICCPROFLIB_API icMD5Init ( MD5_CTX context)

MD5 initialization. Begins an MD5 operation, writing a new context.

100{
101 context->count[0] = context->count[1] = 0;
102 /* Load magic initialization constants.
103*/
104 context->state[0] = 0x67452301;
105 context->state[1] = 0xefcdab89;
106 context->state[2] = 0x98badcfe;
107 context->state[3] = 0x10325476;
108}

References MD5_CTX::count, and MD5_CTX::state.

Referenced by CalcProfileID().

+ Here is the caller graph for this function:

◆ icMD5Update()

void ICCPROFLIB_API icMD5Update ( MD5_CTX context,
unsigned char *  input,
unsigned int  inputLen 
)

MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context.

115{
116 unsigned int i, index, partLen;
117
118 /* Compute number of bytes mod 64 */
119 index = (unsigned int)((context->count[0] >> 3) & 0x3F);
120
121 /* Update number of bits */
122 if ((context->count[0] += ((UINT4)inputLen << 3))
123 < ((UINT4)inputLen << 3))
124 context->count[1]++;
125 context->count[1] += ((UINT4)inputLen >> 29);
126
127 partLen = 64 - index;
128
129 /* Transform as many times as possible.
130 */
131 if (inputLen >= partLen) {
132 memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen);
133 MD5Transform (context->state, context->buffer);
134
135 for (i = partLen; i + 63 < inputLen; i += 64)
136 MD5Transform (context->state, &input[i]);
137
138 index = 0;
139 }
140 else
141 i = 0;
142
143 /* Buffer remaining input */
144 memcpy((POINTER)&context->buffer[index], (POINTER)&input[i],inputLen-i);
145}
ICCUINT32 UINT4
Definition IccMD5.h:48
static void MD5Transform(UINT4[4], unsigned char[64])
Definition IccMD5.cpp:178

References MD5_CTX::buffer, MD5_CTX::count, MD5Transform(), and MD5_CTX::state.

Referenced by CalcProfileID(), and icMD5Final().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: