MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / MD5Update

Function MD5Update

src/core/md5.cpp:125–161  ·  view source on GitHub ↗

The routine MD5Update updates the message-digest context to account for the presence of each of the characters inBuf[0..inLen-1] in the message whose digest is being computed. */

Source from the content-addressed store, hash-verified

123 account for the presence of each of the characters inBuf[0..inLen-1]
124 in the message whose digest is being computed. */
125void MD5Update (MD5_CTX* mdContext, uint8* inBuf, unsigned int inLen)
126{
127 uint32 in[16];
128 int mdi;
129 unsigned int i, ii;
130
131 /* compute number of bytes mod 64 */
132 mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
133
134 /* update number of bits */
135#ifndef UNICOS
136 if ((mdContext->i[0] + ((uint32)inLen << 3)) < mdContext->i[0])
137#else
138 if (((mdContext->i[0]+((uint32)inLen << 3)) & 0xffffffff) < mdContext->i[0])
139#endif
140
141 mdContext->i[1]++;
142
143 mdContext->i[0] += ((uint32)inLen << 3);
144 mdContext->i[1] += ((uint32)inLen >> 29);
145
146 while (inLen--) {
147 /* add new character to buffer, increment mdi */
148 mdContext->in[mdi++] = *inBuf++;
149
150 /* transform if necessary */
151 if (mdi == 0x40) {
152 for (i = 0, ii = 0; i < 16; i++, ii += 4)
153 in[i] = (((uint32)mdContext->in[ii+3]) << 24) |
154 (((uint32)mdContext->in[ii+2]) << 16) |
155 (((uint32)mdContext->in[ii+1]) << 8) |
156 ((uint32)mdContext->in[ii]);
157 Transform (mdContext->buf, in);
158 mdi = 0;
159 }
160 }
161}
162
163/* The routine MD5Final terminates the message-digest computation and
164 ends with the desired message digest in mdContext->digest[0...15]. */

Callers 2

UpdateMethod · 0.85
MD5FinalFunction · 0.85

Calls 1

TransformFunction · 0.85

Tested by

no test coverage detected