D:/opendownloadmanager/ODM-1.x/Hash/md5.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include "MD5.h"

Go to the source code of this file.

Defines

#define MD5_F(x, y, z)   (((x) & (y)) | ((~x) & (z)))
#define MD5_G(x, y, z)   (((x) & (z)) | ((y) & (~z)))
#define MD5_H(x, y, z)   ((x) ^ (y) ^ (z))
#define MD5_I(x, y, z)   ((y) ^ ((x) | (~z)))
#define ROTATE_LEFT(x, n)   (((x) << (n)) | ((x) >> (32-(n))))
#define MD5_FF(a, b, c, d, x, s, ac)   {(a) += MD5_F ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
#define MD5_GG(a, b, c, d, x, s, ac)   {(a) += MD5_G ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
#define MD5_HH(a, b, c, d, x, s, ac)   {(a) += MD5_H ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
#define MD5_II(a, b, c, d, x, s, ac)   {(a) += MD5_I ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
#define MD5_S11   7
#define MD5_S12   12
#define MD5_S13   17
#define MD5_S14   22
#define MD5_S21   5
#define MD5_S22   9
#define MD5_S23   14
#define MD5_S24   20
#define MD5_S31   4
#define MD5_S32   11
#define MD5_S33   16
#define MD5_S34   23
#define MD5_S41   6
#define MD5_S42   10
#define MD5_S43   15
#define MD5_S44   21

Functions

static void MD5_Transform (UINT4 *buf, UINT4 *in)
void MD5Init (MD5_CTX *mdContext, unsigned long pseudoRandomNumber)
void MD5Update (MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen)
void MD5Final (MD5_CTX *mdContext)
int md5file (char *fn, unsigned long seed, MD5_CTX *mdContext)

Variables

static unsigned char MD5_PADDING [64]


Define Documentation

#define MD5_F ( x,
y,
 )     (((x) & (y)) | ((~x) & (z)))

Definition at line 20 of file md5.cpp.

#define MD5_FF ( a,
b,
c,
d,
x,
s,
ac   )     {(a) += MD5_F ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }

Definition at line 29 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_G ( x,
y,
 )     (((x) & (z)) | ((y) & (~z)))

Definition at line 21 of file md5.cpp.

#define MD5_GG ( a,
b,
c,
d,
x,
s,
ac   )     {(a) += MD5_G ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }

Definition at line 30 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_H ( x,
y,
 )     ((x) ^ (y) ^ (z))

Definition at line 22 of file md5.cpp.

#define MD5_HH ( a,
b,
c,
d,
x,
s,
ac   )     {(a) += MD5_H ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }

Definition at line 31 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_I ( x,
y,
 )     ((y) ^ ((x) | (~z)))

Definition at line 23 of file md5.cpp.

#define MD5_II ( a,
b,
c,
d,
x,
s,
ac   )     {(a) += MD5_I ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }

Definition at line 32 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S11   7

Definition at line 34 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S12   12

Definition at line 35 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S13   17

Definition at line 36 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S14   22

Definition at line 37 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S21   5

Definition at line 38 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S22   9

Definition at line 39 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S23   14

Definition at line 40 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S24   20

Definition at line 41 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S31   4

Definition at line 42 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S32   11

Definition at line 43 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S33   16

Definition at line 44 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S34   23

Definition at line 45 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S41   6

Definition at line 46 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S42   10

Definition at line 47 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S43   15

Definition at line 48 of file md5.cpp.

Referenced by MD5_Transform().

#define MD5_S44   21

Definition at line 49 of file md5.cpp.

Referenced by MD5_Transform().

#define ROTATE_LEFT ( x,
n   )     (((x) << (n)) | ((x) >> (32-(n))))

Definition at line 26 of file md5.cpp.


Function Documentation

static void MD5_Transform ( UINT4 buf,
UINT4 in 
) [static]

Definition at line 51 of file md5.cpp.

References a, b, c, MD5_FF, MD5_GG, MD5_HH, MD5_II, MD5_S11, MD5_S12, MD5_S13, MD5_S14, MD5_S21, MD5_S22, MD5_S23, MD5_S24, MD5_S31, MD5_S32, MD5_S33, MD5_S34, MD5_S41, MD5_S42, MD5_S43, and MD5_S44.

Referenced by MD5Final(), and MD5Update().

int md5file ( char *  fn,
unsigned long  seed,
MD5_CTX mdContext 
)

Definition at line 214 of file md5.cpp.

References fread(), MD5Final(), MD5Init(), MD5Update(), and NULL.

void MD5Final ( MD5_CTX mdContext  ) 

void MD5Init ( MD5_CTX mdContext,
unsigned long  pseudoRandomNumber 
)

Definition at line 133 of file md5.cpp.

References MD5_CTX::buf, and MD5_CTX::i.

Referenced by vmsHash::Hash_MD5_File(), and md5file().

void MD5Update ( MD5_CTX mdContext,
unsigned char *  inBuf,
unsigned int  inLen 
)

Definition at line 144 of file md5.cpp.

References MD5_CTX::buf, MD5_CTX::i, MD5_CTX::in, and MD5_Transform().

Referenced by vmsHash::Hash_MD5_File(), md5file(), and MD5Final().


Variable Documentation

unsigned char MD5_PADDING[64] [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
}

Definition at line 9 of file md5.cpp.

Referenced by MD5Final().


Generated on Sun May 25 00:19:53 2008 by  doxygen 1.5.6