void md5_final ( struct md5_context m,
unsigned char  out[16] 
)

Finalize the hash value and return its hash value.

Definition at line 224 of file md5.c.

00225 {
00226         unsigned char *b;
00227         size_t blen;
00228 
00229         /* Terminate the data with 0x80 */
00230         b = (unsigned char *)m->buf;
00231         blen = m->count & 0x3f;
00232         b[blen++] = 0x80;
00233 
00234         if (blen > 56) {
00235                 /* We can't fit the length. Allocate an extra block. */
00236                 memset(b + blen, 0, 64 - blen);
00237                 md5_decode(m->buf);
00238                 md5_transform(m->state, m->buf);
00239 
00240                 /* Add a new zero-block */
00241                 memset(b, 0, 56);
00242         } else {
00243                 /* The length will fit */
00244                 memset(b + blen, 0, 56 - blen);
00245                 md5_decode(m->buf);
00246         }
00247 
00248         /* Store the length in bits in the hash as well */
00249         m->buf[14] = m->count << 3;
00250         m->buf[15] = m->count >> 29;
00251         md5_transform(m->state, m->buf);
00252 
00253         /* Copy out the hash and zero our internal storage */
00254         md5_encode((uint32_t *)out, m->state);
00255         memset(m, 0, sizeof(struct md5_context));
00256 }

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