src/network/md5.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  md5_state_s

Typedefs

typedef unsigned char md5_byte_t
typedef unsigned int md5_word_t
typedef struct md5_state_s md5_state_t

Functions

void md5_init (md5_state_t *pms)
void md5_append (md5_state_t *pms, const md5_byte_t *data, int nbytes)
void md5_finish (md5_state_t *pms, md5_byte_t digest[16])


Typedef Documentation

typedef unsigned char md5_byte_t

Definition at line 86 of file md5.h.

typedef struct md5_state_s md5_state_t

typedef unsigned int md5_word_t

Definition at line 87 of file md5.h.


Function Documentation

void md5_append ( md5_state_t pms,
const md5_byte_t data,
int  nbytes 
)

Definition at line 387 of file md5.cpp.

References md5_state_s::buf, md5_state_s::count, and md5_process().

Referenced by nKrawall::BrokenScramblePassword(), md5_finish(), nKrawall::ScramblePassword(), and nKrawall::ScrambleWithSalt2().

00390 {
00391     const md5_byte_t *p = data;
00392     int left = nbytes;
00393     int offset = (pms->count[0] >> 3) & 63;
00394     md5_word_t nbits = (md5_word_t)(nbytes << 3);
00395 
00396     if (nbytes <= 0)
00397         return;
00398 
00399     /* Update the message length. */
00400     pms->count[1] += nbytes >> 29;
00401     pms->count[0] += nbits;
00402     if (pms->count[0] < nbits)
00403         pms->count[1]++;
00404 
00405     /* Process an initial partial block. */
00406     if (offset) {
00407         int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
00408 
00409         memcpy(pms->buf + offset, p, copy);
00410         if (offset + copy < 64)
00411             return;
00412         p += copy;
00413         left -= copy;
00414         md5_process(pms, pms->buf);
00415     }
00416 
00417     /* Process full blocks. */
00418     for (; left >= 64; p += 64, left -= 64)
00419         md5_process(pms, p);
00420 
00421     /* Process a final partial block. */
00422     if (left)

Here is the call graph for this function:

Here is the caller graph for this function:

void md5_finish ( md5_state_t pms,
md5_byte_t  digest[16] 
)

Definition at line 425 of file md5.cpp.

References md5_state_s::abcd, md5_state_s::count, and md5_append().

Referenced by nKrawall::BrokenScramblePassword(), nKrawall::ScramblePassword(), and nKrawall::ScrambleWithSalt2().

00428 {
00429     static const md5_byte_t pad[64] = {
00430                                           0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00431                                           0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00432                                           0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00433                                           0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
00434                                       };
00435     md5_byte_t data[8];
00436     int i;
00437 
00438     /* Save the length before padding. */
00439     for (i = 0; i < 8; ++i)
00440         data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
00441     /* Pad to 56 bytes mod 64. */
00442     md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
00443     /* Append the length. */
00444     md5_append(pms, data, 8);
00445     for (i = 0; i < 16; ++i)

Here is the call graph for this function:

Here is the caller graph for this function:

void md5_init ( md5_state_t pms  ) 

Definition at line 377 of file md5.cpp.

References md5_state_s::abcd, md5_state_s::count, and T_MASK.

Referenced by nKrawall::BrokenScramblePassword(), nKrawall::ScramblePassword(), and nKrawall::ScrambleWithSalt2().

00380 {
00381     pms->count[0] = pms->count[1] = 0;
00382     pms->abcd[0] = 0x67452301;
00383     pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
00384     pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;

Here is the caller graph for this function:


Generated on Sat Mar 15 23:00:21 2008 for Armagetron Advanced by  doxygen 1.5.4