void md5_update ( struct md5_context m,
const void *  buf,
size_t  len 
)

Update the hash value by appending a buffer.

Definition at line 181 of file md5.c.

00182 {
00183         unsigned char *b, *ib;
00184         size_t blen, left, clen;
00185 
00186         /* Store how many bytes we process and obtain the buffer length */
00187         b = (unsigned char *)m->buf;
00188         blen = m->count & 0x3f;
00189         m->count += len;
00190         ib = (unsigned char *)buf;
00191 
00192         /* Finish off an incomplete chunk first if we must */
00193         if (blen != 0) {
00194                 /* How many bytes we still need */
00195                 left = 64 - blen;
00196                 /* How many bytes we're going to copy */
00197                 clen = MIN(left, len);
00198 
00199                 memcpy(b + blen, ib, clen);
00200                 /* This still doesn't make up for a full block */
00201                 if (len < left)
00202                         return;
00203 
00204                 md5_decode(m->buf);
00205                 md5_transform(m->state, m->buf);
00206                 ib += clen;
00207                 len -= clen;
00208         }
00209 
00210         /* Handle the data in 64 byte chunks */
00211         while (len >= 64) {
00212                 memcpy(m->buf, ib, 64);
00213                 md5_decode(m->buf);
00214                 md5_transform(m->state, m->buf);
00215                 ib += 64;
00216                 len -= 64;
00217         }
00218 
00219         /* Copy in the last partial frame */
00220         memcpy(m->buf, ib, len);
00221 }

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Defines
Generated on Mon Mar 15 04:45:40 2010 for herrie by  doxygen 1.6.3