Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
md5.c File Reference
#include "prerr.h"
#include "secerr.h"
#include "prtypes.h"
#include "prlong.h"
#include "blapi.h"

Go to the source code of this file.


struct  MD5ContextStr
union  MD5ContextStr.u


#define MD5_HASH_LEN   16
#define MD5_BUFFER_SIZE   64
#define MD5_END_BUFFER   (MD5_BUFFER_SIZE - 8)
#define CV0_1   0x67452301
#define CV0_2   0xefcdab89
#define CV0_3   0x98badcfe
#define CV0_4   0x10325476
#define T1_0   0xd76aa478
#define T1_1   0xe8c7b756
#define T1_2   0x242070db
#define T1_3   0xc1bdceee
#define T1_4   0xf57c0faf
#define T1_5   0x4787c62a
#define T1_6   0xa8304613
#define T1_7   0xfd469501
#define T1_8   0x698098d8
#define T1_9   0x8b44f7af
#define T1_10   0xffff5bb1
#define T1_11   0x895cd7be
#define T1_12   0x6b901122
#define T1_13   0xfd987193
#define T1_14   0xa679438e
#define T1_15   0x49b40821
#define T2_0   0xf61e2562
#define T2_1   0xc040b340
#define T2_2   0x265e5a51
#define T2_3   0xe9b6c7aa
#define T2_4   0xd62f105d
#define T2_5   0x02441453
#define T2_6   0xd8a1e681
#define T2_7   0xe7d3fbc8
#define T2_8   0x21e1cde6
#define T2_9   0xc33707d6
#define T2_10   0xf4d50d87
#define T2_11   0x455a14ed
#define T2_12   0xa9e3e905
#define T2_13   0xfcefa3f8
#define T2_14   0x676f02d9
#define T2_15   0x8d2a4c8a
#define T3_0   0xfffa3942
#define T3_1   0x8771f681
#define T3_2   0x6d9d6122
#define T3_3   0xfde5380c
#define T3_4   0xa4beea44
#define T3_5   0x4bdecfa9
#define T3_6   0xf6bb4b60
#define T3_7   0xbebfbc70
#define T3_8   0x289b7ec6
#define T3_9   0xeaa127fa
#define T3_10   0xd4ef3085
#define T3_11   0x04881d05
#define T3_12   0xd9d4d039
#define T3_13   0xe6db99e5
#define T3_14   0x1fa27cf8
#define T3_15   0xc4ac5665
#define T4_0   0xf4292244
#define T4_1   0x432aff97
#define T4_2   0xab9423a7
#define T4_3   0xfc93a039
#define T4_4   0x655b59c3
#define T4_5   0x8f0ccc92
#define T4_6   0xffeff47d
#define T4_7   0x85845dd1
#define T4_8   0x6fa87e4f
#define T4_9   0xfe2ce6e0
#define T4_10   0xa3014314
#define T4_11   0x4e0811a1
#define T4_12   0xf7537e82
#define T4_13   0xbd3af235
#define T4_14   0x2ad7d2bb
#define T4_15   0xeb86d391
#define R1B0   0
#define R1B1   1
#define R1B2   2
#define R1B3   3
#define R1B4   4
#define R1B5   5
#define R1B6   6
#define R1B7   7
#define R1B8   8
#define R1B9   9
#define R1B10   10
#define R1B11   11
#define R1B12   12
#define R1B13   13
#define R1B14   14
#define R1B15   15
#define R2B0   1
#define R2B1   6
#define R2B2   11
#define R2B3   0
#define R2B4   5
#define R2B5   10
#define R2B6   15
#define R2B7   4
#define R2B8   9
#define R2B9   14
#define R2B10   3
#define R2B11   8
#define R2B12   13
#define R2B13   2
#define R2B14   7
#define R2B15   12
#define R3B0   5
#define R3B1   8
#define R3B2   11
#define R3B3   14
#define R3B4   1
#define R3B5   4
#define R3B6   7
#define R3B7   10
#define R3B8   13
#define R3B9   0
#define R3B10   3
#define R3B11   6
#define R3B12   9
#define R3B13   12
#define R3B14   15
#define R3B15   2
#define R4B0   0
#define R4B1   7
#define R4B2   14
#define R4B3   5
#define R4B4   12
#define R4B5   3
#define R4B6   10
#define R4B7   1
#define R4B8   8
#define R4B9   15
#define R4B10   6
#define R4B11   13
#define R4B12   4
#define R4B13   11
#define R4B14   2
#define R4B15   9
#define S1_0   7
#define S1_1   12
#define S1_2   17
#define S1_3   22
#define S2_0   5
#define S2_1   9
#define S2_2   14
#define S2_3   20
#define S3_0   4
#define S3_1   11
#define S3_2   16
#define S3_3   23
#define S4_0   6
#define S4_1   10
#define S4_2   15
#define S4_3   21
#define inBuf   u.b
#define cls(i32, s)   (tmp = i32, tmp << s | tmp >> (32 - s))
#define addto64(sumhigh, sumlow, addend)   sumlow += addend; if (sumlow < addend) ++sumhigh;
#define MASK   0x00ff00ff
#define lendian(i32)   (tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK)
#define lebytes(b4)   ((b4)[3] << 24 | (b4)[2] << 16 | (b4)[1] << 8 | (b4)[0])
#define F(X, Y, Z)   ((X & Y) | ((~X) & Z))
#define G(X, Y, Z)   ((X & Z) | (Y & (~Z)))
#define H(X, Y, Z)   (X ^ Y ^ Z)
#define I(X, Y, Z)   (Y ^ (X | (~Z)))
#define FF(a, b, c, d, bufint, s, ti)   a = b + cls(a + F(b, c, d) + bufint + ti, s)
#define GG(a, b, c, d, bufint, s, ti)   a = b + cls(a + G(b, c, d) + bufint + ti, s)
#define HH(a, b, c, d, bufint, s, ti)   a = b + cls(a + H(b, c, d) + bufint + ti, s)
#define II(a, b, c, d, bufint, s, ti)   a = b + cls(a + I(b, c, d) + bufint + ti, s)


SECStatus MD5_Hash (unsigned char *dest, const char *src)
SECStatus MD5_HashBuf (unsigned char *dest, const unsigned char *src, uint32 src_length)
MD5ContextMD5_NewContext (void)
void MD5_DestroyContext (MD5Context *cx, PRBool freeit)
void MD5_Begin (MD5Context *cx)
static void md5_prep_state_le (MD5Context *cx)
static void md5_prep_buffer_le (MD5Context *cx, const PRUint8 *beBuf)
static void md5_compress (MD5Context *cx, const PRUint32 *wBuf)
void MD5_Update (MD5Context *cx, const unsigned char *input, unsigned int inputLen)
void MD5_End (MD5Context *cx, unsigned char *digest, unsigned int *digestLen, unsigned int maxDigestLen)
unsigned int MD5_FlattenSize (MD5Context *cx)
SECStatus MD5_Flatten (MD5Context *cx, unsigned char *space)
MD5ContextMD5_Resurrect (unsigned char *space, void *arg)
void MD5_Clone (MD5Context *dest, MD5Context *src)
void MD5_TraceState (MD5Context *cx)


static const unsigned char padbytes []

Class Documentation

struct MD5ContextStr

Definition at line 210 of file md5.c.

Class Members
PRUint32 cv
PRUint32 lsbInput
PRUint32 msbInput
union MD5ContextStr u
union MD5ContextStr u
union MD5ContextStr.u

Definition at line 214 of file md5.c.

Class Members
PRUint8 b
PRUint32 w

Define Documentation

#define addto64 (   sumhigh,
)    sumlow += addend; if (sumlow < addend) ++sumhigh;

Definition at line 280 of file md5.c.

#define cls (   i32,
)    (tmp = i32, tmp << s | tmp >> (32 - s))

Definition at line 274 of file md5.c.

#define CV0_1   0x67452301

Definition at line 49 of file md5.c.

#define CV0_2   0xefcdab89

Definition at line 50 of file md5.c.

#define CV0_3   0x98badcfe

Definition at line 51 of file md5.c.

#define CV0_4   0x10325476

Definition at line 52 of file md5.c.

#define F (   X,
)    ((X & Y) | ((~X) & Z))

Definition at line 343 of file md5.c.

#define FF (   a,
)    a = b + cls(a + F(b, c, d) + bufint + ti, s)

Definition at line 355 of file md5.c.

#define G (   X,
)    ((X & Z) | (Y & (~Z)))

Definition at line 346 of file md5.c.

#define GG (   a,
)    a = b + cls(a + G(b, c, d) + bufint + ti, s)

Definition at line 358 of file md5.c.

#define H (   X,
)    (X ^ Y ^ Z)

Definition at line 349 of file md5.c.

#define HH (   a,
)    a = b + cls(a + H(b, c, d) + bufint + ti, s)

Definition at line 361 of file md5.c.

#define I (   X,
)    (Y ^ (X | (~Z)))

Definition at line 352 of file md5.c.

#define II (   a,
)    a = b + cls(a + I(b, c, d) + bufint + ti, s)

Definition at line 364 of file md5.c.

typedef unsigned char * inBuf   u.b

Definition at line 220 of file md5.c.

#define lebytes (   b4)    ((b4)[3] << 24 | (b4)[2] << 16 | (b4)[1] << 8 | (b4)[0])

Definition at line 295 of file md5.c.

#define lendian (   i32)    (tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK)

Definition at line 289 of file md5.c.

#define MASK   0x00ff00ff

Definition at line 284 of file md5.c.

Definition at line 46 of file md5.c.

Definition at line 47 of file md5.c.

#define MD5_HASH_LEN   16

Definition at line 45 of file md5.c.

#define R1B0   0

Definition at line 122 of file md5.c.

#define R1B1   1

Definition at line 123 of file md5.c.

#define R1B10   10

Definition at line 132 of file md5.c.

#define R1B11   11

Definition at line 133 of file md5.c.

#define R1B12   12

Definition at line 134 of file md5.c.

#define R1B13   13

Definition at line 135 of file md5.c.

#define R1B14   14

Definition at line 136 of file md5.c.

#define R1B15   15

Definition at line 137 of file md5.c.

#define R1B2   2

Definition at line 124 of file md5.c.

#define R1B3   3

Definition at line 125 of file md5.c.

#define R1B4   4

Definition at line 126 of file md5.c.

#define R1B5   5

Definition at line 127 of file md5.c.

#define R1B6   6

Definition at line 128 of file md5.c.

#define R1B7   7

Definition at line 129 of file md5.c.

#define R1B8   8

Definition at line 130 of file md5.c.

#define R1B9   9

Definition at line 131 of file md5.c.

#define R2B0   1

Definition at line 139 of file md5.c.

#define R2B1   6

Definition at line 140 of file md5.c.

#define R2B10   3

Definition at line 149 of file md5.c.

#define R2B11   8

Definition at line 150 of file md5.c.

#define R2B12   13

Definition at line 151 of file md5.c.

#define R2B13   2

Definition at line 152 of file md5.c.

#define R2B14   7

Definition at line 153 of file md5.c.

#define R2B15   12

Definition at line 154 of file md5.c.

#define R2B2   11

Definition at line 141 of file md5.c.

#define R2B3   0

Definition at line 142 of file md5.c.

#define R2B4   5

Definition at line 143 of file md5.c.

#define R2B5   10

Definition at line 144 of file md5.c.

#define R2B6   15

Definition at line 145 of file md5.c.

#define R2B7   4

Definition at line 146 of file md5.c.

#define R2B8   9

Definition at line 147 of file md5.c.

#define R2B9   14

Definition at line 148 of file md5.c.

#define R3B0   5

Definition at line 156 of file md5.c.

#define R3B1   8

Definition at line 157 of file md5.c.

#define R3B10   3

Definition at line 166 of file md5.c.

#define R3B11   6

Definition at line 167 of file md5.c.

#define R3B12   9

Definition at line 168 of file md5.c.

#define R3B13   12

Definition at line 169 of file md5.c.

#define R3B14   15

Definition at line 170 of file md5.c.

#define R3B15   2

Definition at line 171 of file md5.c.

#define R3B2   11

Definition at line 158 of file md5.c.

#define R3B3   14

Definition at line 159 of file md5.c.

#define R3B4   1

Definition at line 160 of file md5.c.

#define R3B5   4

Definition at line 161 of file md5.c.

#define R3B6   7

Definition at line 162 of file md5.c.

#define R3B7   10

Definition at line 163 of file md5.c.

#define R3B8   13

Definition at line 164 of file md5.c.

#define R3B9   0

Definition at line 165 of file md5.c.

#define R4B0   0

Definition at line 173 of file md5.c.

#define R4B1   7

Definition at line 174 of file md5.c.

#define R4B10   6

Definition at line 183 of file md5.c.

#define R4B11   13

Definition at line 184 of file md5.c.

#define R4B12   4

Definition at line 185 of file md5.c.

#define R4B13   11

Definition at line 186 of file md5.c.

#define R4B14   2

Definition at line 187 of file md5.c.

#define R4B15   9

Definition at line 188 of file md5.c.

#define R4B2   14

Definition at line 175 of file md5.c.

#define R4B3   5

Definition at line 176 of file md5.c.

#define R4B4   12

Definition at line 177 of file md5.c.

#define R4B5   3

Definition at line 178 of file md5.c.

#define R4B6   10

Definition at line 179 of file md5.c.

#define R4B7   1

Definition at line 180 of file md5.c.

#define R4B8   8

Definition at line 181 of file md5.c.

#define R4B9   15

Definition at line 182 of file md5.c.

#define S1_0   7

Definition at line 190 of file md5.c.

#define S1_1   12

Definition at line 191 of file md5.c.

#define S1_2   17

Definition at line 192 of file md5.c.

#define S1_3   22

Definition at line 193 of file md5.c.

#define S2_0   5

Definition at line 195 of file md5.c.

#define S2_1   9

Definition at line 196 of file md5.c.

#define S2_2   14

Definition at line 197 of file md5.c.

#define S2_3   20

Definition at line 198 of file md5.c.

#define S3_0   4

Definition at line 200 of file md5.c.

#define S3_1   11

Definition at line 201 of file md5.c.

#define S3_2   16

Definition at line 202 of file md5.c.

#define S3_3   23

Definition at line 203 of file md5.c.

#define S4_0   6

Definition at line 205 of file md5.c.

#define S4_1   10

Definition at line 206 of file md5.c.

#define S4_2   15

Definition at line 207 of file md5.c.

#define S4_3   21

Definition at line 208 of file md5.c.

#define T1_0   0xd76aa478

Definition at line 54 of file md5.c.

#define T1_1   0xe8c7b756

Definition at line 55 of file md5.c.

#define T1_10   0xffff5bb1

Definition at line 64 of file md5.c.

#define T1_11   0x895cd7be

Definition at line 65 of file md5.c.

#define T1_12   0x6b901122

Definition at line 66 of file md5.c.

#define T1_13   0xfd987193

Definition at line 67 of file md5.c.

#define T1_14   0xa679438e

Definition at line 68 of file md5.c.

#define T1_15   0x49b40821

Definition at line 69 of file md5.c.

#define T1_2   0x242070db

Definition at line 56 of file md5.c.

#define T1_3   0xc1bdceee

Definition at line 57 of file md5.c.

#define T1_4   0xf57c0faf

Definition at line 58 of file md5.c.

#define T1_5   0x4787c62a

Definition at line 59 of file md5.c.

#define T1_6   0xa8304613

Definition at line 60 of file md5.c.

#define T1_7   0xfd469501

Definition at line 61 of file md5.c.

#define T1_8   0x698098d8

Definition at line 62 of file md5.c.

#define T1_9   0x8b44f7af

Definition at line 63 of file md5.c.

#define T2_0   0xf61e2562

Definition at line 71 of file md5.c.

#define T2_1   0xc040b340

Definition at line 72 of file md5.c.

#define T2_10   0xf4d50d87

Definition at line 81 of file md5.c.

#define T2_11   0x455a14ed

Definition at line 82 of file md5.c.

#define T2_12   0xa9e3e905

Definition at line 83 of file md5.c.

#define T2_13   0xfcefa3f8

Definition at line 84 of file md5.c.

#define T2_14   0x676f02d9

Definition at line 85 of file md5.c.

#define T2_15   0x8d2a4c8a

Definition at line 86 of file md5.c.

#define T2_2   0x265e5a51

Definition at line 73 of file md5.c.

#define T2_3   0xe9b6c7aa

Definition at line 74 of file md5.c.

#define T2_4   0xd62f105d

Definition at line 75 of file md5.c.

#define T2_5   0x02441453

Definition at line 76 of file md5.c.

#define T2_6   0xd8a1e681

Definition at line 77 of file md5.c.

#define T2_7   0xe7d3fbc8

Definition at line 78 of file md5.c.

#define T2_8   0x21e1cde6

Definition at line 79 of file md5.c.

#define T2_9   0xc33707d6

Definition at line 80 of file md5.c.

#define T3_0   0xfffa3942

Definition at line 88 of file md5.c.

#define T3_1   0x8771f681

Definition at line 89 of file md5.c.

#define T3_10   0xd4ef3085

Definition at line 98 of file md5.c.

#define T3_11   0x04881d05

Definition at line 99 of file md5.c.

#define T3_12   0xd9d4d039

Definition at line 100 of file md5.c.

#define T3_13   0xe6db99e5

Definition at line 101 of file md5.c.

#define T3_14   0x1fa27cf8

Definition at line 102 of file md5.c.

#define T3_15   0xc4ac5665

Definition at line 103 of file md5.c.

#define T3_2   0x6d9d6122

Definition at line 90 of file md5.c.

#define T3_3   0xfde5380c

Definition at line 91 of file md5.c.

#define T3_4   0xa4beea44

Definition at line 92 of file md5.c.

#define T3_5   0x4bdecfa9

Definition at line 93 of file md5.c.

#define T3_6   0xf6bb4b60

Definition at line 94 of file md5.c.

#define T3_7   0xbebfbc70

Definition at line 95 of file md5.c.

#define T3_8   0x289b7ec6

Definition at line 96 of file md5.c.

#define T3_9   0xeaa127fa

Definition at line 97 of file md5.c.

#define T4_0   0xf4292244

Definition at line 105 of file md5.c.

#define T4_1   0x432aff97

Definition at line 106 of file md5.c.

#define T4_10   0xa3014314

Definition at line 115 of file md5.c.

#define T4_11   0x4e0811a1

Definition at line 116 of file md5.c.

#define T4_12   0xf7537e82

Definition at line 117 of file md5.c.

#define T4_13   0xbd3af235

Definition at line 118 of file md5.c.

#define T4_14   0x2ad7d2bb

Definition at line 119 of file md5.c.

#define T4_15   0xeb86d391

Definition at line 120 of file md5.c.

#define T4_2   0xab9423a7

Definition at line 107 of file md5.c.

#define T4_3   0xfc93a039

Definition at line 108 of file md5.c.

#define T4_4   0x655b59c3

Definition at line 109 of file md5.c.

#define T4_5   0x8f0ccc92

Definition at line 110 of file md5.c.

#define T4_6   0xffeff47d

Definition at line 111 of file md5.c.

#define T4_7   0x85845dd1

Definition at line 112 of file md5.c.

#define T4_8   0x6fa87e4f

Definition at line 113 of file md5.c.

#define T4_9   0xfe2ce6e0

Definition at line 114 of file md5.c.

Function Documentation

Definition at line 263 of file md5.c.

       cx->lsbInput = 0;
       cx->msbInput = 0;
/*     memset(cx->inBuf, 0, sizeof(cx->inBuf)); */
       cx->cv[0] = CV0_1;
       cx->cv[1] = CV0_2;
       cx->cv[2] = CV0_3;
       cx->cv[3] = CV0_4;
void MD5_Clone ( MD5Context dest,
MD5Context src 

Definition at line 586 of file md5.c.

       memcpy(dest, src, sizeof *dest);

Here is the call graph for this function:

static void md5_compress ( MD5Context cx,
const PRUint32 wBuf 
) [static]

Definition at line 368 of file md5.c.

       PRUint32 a, b, c, d;
       PRUint32 tmp;
       a = cx->cv[0];
       b = cx->cv[1];
       c = cx->cv[2];
       d = cx->cv[3];
       FF(a, b, c, d, wBuf[R1B0 ], S1_0, T1_0);
       FF(d, a, b, c, wBuf[R1B1 ], S1_1, T1_1);
       FF(c, d, a, b, wBuf[R1B2 ], S1_2, T1_2);
       FF(b, c, d, a, wBuf[R1B3 ], S1_3, T1_3);
       FF(a, b, c, d, wBuf[R1B4 ], S1_0, T1_4);
       FF(d, a, b, c, wBuf[R1B5 ], S1_1, T1_5);
       FF(c, d, a, b, wBuf[R1B6 ], S1_2, T1_6);
       FF(b, c, d, a, wBuf[R1B7 ], S1_3, T1_7);
       FF(a, b, c, d, wBuf[R1B8 ], S1_0, T1_8);
       FF(d, a, b, c, wBuf[R1B9 ], S1_1, T1_9);
       FF(c, d, a, b, wBuf[R1B10], S1_2, T1_10);
       FF(b, c, d, a, wBuf[R1B11], S1_3, T1_11);
       FF(a, b, c, d, wBuf[R1B12], S1_0, T1_12);
       FF(d, a, b, c, wBuf[R1B13], S1_1, T1_13);
       FF(c, d, a, b, wBuf[R1B14], S1_2, T1_14);
       FF(b, c, d, a, wBuf[R1B15], S1_3, T1_15);
       GG(a, b, c, d, wBuf[R2B0 ], S2_0, T2_0);
       GG(d, a, b, c, wBuf[R2B1 ], S2_1, T2_1);
       GG(c, d, a, b, wBuf[R2B2 ], S2_2, T2_2);
       GG(b, c, d, a, wBuf[R2B3 ], S2_3, T2_3);
       GG(a, b, c, d, wBuf[R2B4 ], S2_0, T2_4);
       GG(d, a, b, c, wBuf[R2B5 ], S2_1, T2_5);
       GG(c, d, a, b, wBuf[R2B6 ], S2_2, T2_6);
       GG(b, c, d, a, wBuf[R2B7 ], S2_3, T2_7);
       GG(a, b, c, d, wBuf[R2B8 ], S2_0, T2_8);
       GG(d, a, b, c, wBuf[R2B9 ], S2_1, T2_9);
       GG(c, d, a, b, wBuf[R2B10], S2_2, T2_10);
       GG(b, c, d, a, wBuf[R2B11], S2_3, T2_11);
       GG(a, b, c, d, wBuf[R2B12], S2_0, T2_12);
       GG(d, a, b, c, wBuf[R2B13], S2_1, T2_13);
       GG(c, d, a, b, wBuf[R2B14], S2_2, T2_14);
       GG(b, c, d, a, wBuf[R2B15], S2_3, T2_15);
       HH(a, b, c, d, wBuf[R3B0 ], S3_0, T3_0);
       HH(d, a, b, c, wBuf[R3B1 ], S3_1, T3_1);
       HH(c, d, a, b, wBuf[R3B2 ], S3_2, T3_2);
       HH(b, c, d, a, wBuf[R3B3 ], S3_3, T3_3);
       HH(a, b, c, d, wBuf[R3B4 ], S3_0, T3_4);
       HH(d, a, b, c, wBuf[R3B5 ], S3_1, T3_5);
       HH(c, d, a, b, wBuf[R3B6 ], S3_2, T3_6);
       HH(b, c, d, a, wBuf[R3B7 ], S3_3, T3_7);
       HH(a, b, c, d, wBuf[R3B8 ], S3_0, T3_8);
       HH(d, a, b, c, wBuf[R3B9 ], S3_1, T3_9);
       HH(c, d, a, b, wBuf[R3B10], S3_2, T3_10);
       HH(b, c, d, a, wBuf[R3B11], S3_3, T3_11);
       HH(a, b, c, d, wBuf[R3B12], S3_0, T3_12);
       HH(d, a, b, c, wBuf[R3B13], S3_1, T3_13);
       HH(c, d, a, b, wBuf[R3B14], S3_2, T3_14);
       HH(b, c, d, a, wBuf[R3B15], S3_3, T3_15);
       II(a, b, c, d, wBuf[R4B0 ], S4_0, T4_0);
       II(d, a, b, c, wBuf[R4B1 ], S4_1, T4_1);
       II(c, d, a, b, wBuf[R4B2 ], S4_2, T4_2);
       II(b, c, d, a, wBuf[R4B3 ], S4_3, T4_3);
       II(a, b, c, d, wBuf[R4B4 ], S4_0, T4_4);
       II(d, a, b, c, wBuf[R4B5 ], S4_1, T4_5);
       II(c, d, a, b, wBuf[R4B6 ], S4_2, T4_6);
       II(b, c, d, a, wBuf[R4B7 ], S4_3, T4_7);
       II(a, b, c, d, wBuf[R4B8 ], S4_0, T4_8);
       II(d, a, b, c, wBuf[R4B9 ], S4_1, T4_9);
       II(c, d, a, b, wBuf[R4B10], S4_2, T4_10);
       II(b, c, d, a, wBuf[R4B11], S4_3, T4_11);
       II(a, b, c, d, wBuf[R4B12], S4_0, T4_12);
       II(d, a, b, c, wBuf[R4B13], S4_1, T4_13);
       II(c, d, a, b, wBuf[R4B14], S4_2, T4_14);
       II(b, c, d, a, wBuf[R4B15], S4_3, T4_15);
       cx->cv[0] += a;
       cx->cv[1] += b;
       cx->cv[2] += c;
       cx->cv[3] += d;

Here is the caller graph for this function:

void MD5_DestroyContext ( MD5Context cx,
PRBool  freeit 

Definition at line 254 of file md5.c.

/*     memset(cx, 0, sizeof *cx); */
       if (freeit) {

Here is the call graph for this function:

void MD5_End ( MD5Context cx,
unsigned char *  digest,
unsigned int digestLen,
unsigned int  maxDigestLen 

Definition at line 517 of file md5.c.

       PRUint32 tmp;
       PRUint32 lowInput, highInput;
       PRUint32 inBufIndex = cx->lsbInput & 63;

       if (maxDigestLen < MD5_HASH_LEN) {

       /* Copy out the length of bits input before padding. */
       lowInput = cx->lsbInput; 
       highInput = (cx->msbInput << 3) | (lowInput >> 29);
       lowInput <<= 3;

       if (inBufIndex < MD5_END_BUFFER) {
              MD5_Update(cx, padbytes, MD5_END_BUFFER - inBufIndex);
       } else {
              MD5_Update(cx, padbytes, 
                         MD5_END_BUFFER + MD5_BUFFER_SIZE - inBufIndex);

       /* Store the number of bytes input (before padding) in final 64 bits. */
       cx->u.w[14] = lendian(lowInput);
       cx->u.w[15] = lendian(highInput);

       /* Final call to compress. */
       md5_compress(cx, cx->u.w);

       /* Copy the resulting values out of the chain variables into return buf. */
       *digestLen = MD5_HASH_LEN;
       cx->cv[0] = lendian(cx->cv[0]);
       cx->cv[1] = lendian(cx->cv[1]);
       cx->cv[2] = lendian(cx->cv[2]);
       cx->cv[3] = lendian(cx->cv[3]);
       memcpy(digest, cx->cv, MD5_HASH_LEN);

Here is the call graph for this function:

SECStatus MD5_Flatten ( MD5Context cx,
unsigned char *  space 

Definition at line 571 of file md5.c.

       memcpy(space, cx, sizeof(*cx));
       return SECSuccess;

Here is the call graph for this function:

unsigned int MD5_FlattenSize ( MD5Context cx)

Definition at line 565 of file md5.c.

       return sizeof(*cx);
SECStatus MD5_Hash ( unsigned char *  dest,
const char *  src 

Definition at line 223 of file md5.c.

       return MD5_HashBuf(dest, (unsigned char *)src, PL_strlen(src));

Here is the call graph for this function:

SECStatus MD5_HashBuf ( unsigned char *  dest,
const unsigned char *  src,
uint32  src_length 

Definition at line 229 of file md5.c.

       unsigned int len;
       MD5Context cx;

       MD5_Update(&cx, src, src_length);
       MD5_End(&cx, dest, &len, MD5_HASH_LEN);
/*     memset(&cx, 0, sizeof cx); */
       return SECSuccess;

Here is the call graph for this function:

Definition at line 242 of file md5.c.

       /* no need to ZAlloc, MD5_Begin will init the context */
       MD5Context *cx = (MD5Context *)PORT_Alloc(sizeof(MD5Context));
       if (cx == NULL) {
              return NULL;
       return cx;

Here is the call graph for this function:

static void md5_prep_buffer_le ( MD5Context cx,
const PRUint8 beBuf 
) [static]

Definition at line 321 of file md5.c.

       cx->u.w[0] = lebytes(&beBuf[0]);
       cx->u.w[1] = lebytes(&beBuf[4]);
       cx->u.w[2] = lebytes(&beBuf[8]);
       cx->u.w[3] = lebytes(&beBuf[12]);
       cx->u.w[4] = lebytes(&beBuf[16]);
       cx->u.w[5] = lebytes(&beBuf[20]);
       cx->u.w[6] = lebytes(&beBuf[24]);
       cx->u.w[7] = lebytes(&beBuf[28]);
       cx->u.w[8] = lebytes(&beBuf[32]);
       cx->u.w[9] = lebytes(&beBuf[36]);
       cx->u.w[10] = lebytes(&beBuf[40]);
       cx->u.w[11] = lebytes(&beBuf[44]);
       cx->u.w[12] = lebytes(&beBuf[48]);
       cx->u.w[13] = lebytes(&beBuf[52]);
       cx->u.w[14] = lebytes(&beBuf[56]);
       cx->u.w[15] = lebytes(&beBuf[60]);

Here is the caller graph for this function:

static void md5_prep_state_le ( MD5Context cx) [static]

Definition at line 299 of file md5.c.

       PRUint32 tmp;
       cx->u.w[0] = lendian(cx->u.w[0]);
       cx->u.w[1] = lendian(cx->u.w[1]);
       cx->u.w[2] = lendian(cx->u.w[2]);
       cx->u.w[3] = lendian(cx->u.w[3]);
       cx->u.w[4] = lendian(cx->u.w[4]);
       cx->u.w[5] = lendian(cx->u.w[5]);
       cx->u.w[6] = lendian(cx->u.w[6]);
       cx->u.w[7] = lendian(cx->u.w[7]);
       cx->u.w[8] = lendian(cx->u.w[8]);
       cx->u.w[9] = lendian(cx->u.w[9]);
       cx->u.w[10] = lendian(cx->u.w[10]);
       cx->u.w[11] = lendian(cx->u.w[11]);
       cx->u.w[12] = lendian(cx->u.w[12]);
       cx->u.w[13] = lendian(cx->u.w[13]);
       cx->u.w[14] = lendian(cx->u.w[14]);
       cx->u.w[15] = lendian(cx->u.w[15]);

Here is the caller graph for this function:

MD5Context* MD5_Resurrect ( unsigned char *  space,
void arg 

Definition at line 578 of file md5.c.

       MD5Context *cx = MD5_NewContext();
       if (cx)
              memcpy(cx, space, sizeof(*cx));
       return cx;

Here is the call graph for this function:

Definition at line 592 of file md5.c.

Here is the call graph for this function:

void MD5_Update ( MD5Context cx,
const unsigned char *  input,
unsigned int  inputLen 

Definition at line 447 of file md5.c.

       PRUint32 bytesToConsume;
       PRUint32 inBufIndex = cx->lsbInput & 63;
       const PRUint32 *wBuf;

       /* Add the number of input bytes to the 64-bit input counter. */
       addto64(cx->msbInput, cx->lsbInput, inputLen);
       if (inBufIndex) {
              /* There is already data in the buffer.  Fill with input. */
              bytesToConsume = PR_MIN(inputLen, MD5_BUFFER_SIZE - inBufIndex);
              memcpy(&cx->inBuf[inBufIndex], input, bytesToConsume);
              if (inBufIndex + bytesToConsume >= MD5_BUFFER_SIZE) {
                     /* The buffer is filled.  Run the compression function. */
                     md5_compress(cx, cx->u.w);
              /* Remaining input. */
              inputLen -= bytesToConsume;
              input += bytesToConsume;

       /* Iterate over 64-byte chunks of the message. */
       while (inputLen >= MD5_BUFFER_SIZE) {
#ifdef _X86_
              /* x86 can handle arithmetic on non-word-aligned buffers */
              wBuf = (PRUint32 *)input;
              if ((ptrdiff_t)input & 0x3) {
                     /* buffer not aligned, copy it to force alignment */
                     memcpy(cx->inBuf, input, MD5_BUFFER_SIZE);
                     wBuf = cx->u.w;
              } else {
                     /* buffer is aligned */
                     wBuf = (PRUint32 *)input;
              md5_prep_buffer_le(cx, input);
              wBuf = cx->u.w;
              md5_compress(cx, wBuf);
              inputLen -= MD5_BUFFER_SIZE;
              input += MD5_BUFFER_SIZE;

       /* Tail of message (message bytes mod 64). */
       if (inputLen)
              memcpy(cx->inBuf, input, inputLen);

Here is the call graph for this function:

Variable Documentation

const unsigned char padbytes[] [static]
Initial value:
       0x80, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
       0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00

Definition at line 501 of file md5.c.