md5transform.cpp File Reference


Detailed Description

Implementation of MD5 Checksumming Algorithm.

Definition in file md5transform.cpp.

#include <hn/hnprec.h>
#include <hn/md5transform.h>

Include dependency graph for md5transform.cpp:

Go to the source code of this file.


Defines

#define S11   7
#define S12   12
#define S13   17
#define S14   22
#define S21   5
#define S22   9
#define S23   14
#define S24   20
#define S31   4
#define S32   11
#define S33   16
#define S34   23
#define S41   6
#define S42   10
#define S43   15
#define S44   21
#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 ROTATE_LEFT(x, n)   (((x) << (n)) | ((x) >> (32-(n))))
#define FF(a, b, c, d, x, s, ac)
#define GG(a, b, c, d, x, s, ac)
#define HH(a, b, c, d, x, s, ac)
#define II(a, b, c, d, x, s, ac)

Functions

static void Encode (unsigned char *output, uint32_t *input, uint32_t len)
 Encodes input (UINT4) into output (unsigned char).
static void Decode (uint32_t *output, const unsigned char *input, unsigned int len)
 Decodes input (unsigned char) into output (UINT4).
static void MD5Transform (uint32_t state[4], const unsigned char block[64])

Variables

static const uint8_t padding [64] = { 0x80 }

Define Documentation

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

Definition at line 52 of file md5transform.cpp.

#define FF a,
b,
c,
d,
x,
s,
ac   ) 
 

Value:

{ \
 (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \
 (a) = ROTATE_LEFT ((a), (s)); \
 (a) += (b); \
  }

Definition at line 64 of file md5transform.cpp.

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

Definition at line 53 of file md5transform.cpp.

#define GG a,
b,
c,
d,
x,
s,
ac   ) 
 

Value:

{ \
 (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \
 (a) = ROTATE_LEFT ((a), (s)); \
 (a) += (b); \
  }

Definition at line 69 of file md5transform.cpp.

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

Definition at line 54 of file md5transform.cpp.

#define HH a,
b,
c,
d,
x,
s,
ac   ) 
 

Value:

{ \
 (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \
 (a) = ROTATE_LEFT ((a), (s)); \
 (a) += (b); \
  }

Definition at line 74 of file md5transform.cpp.

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

Definition at line 55 of file md5transform.cpp.

#define II a,
b,
c,
d,
x,
s,
ac   ) 
 

Value:

{ \
 (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \
 (a) = ROTATE_LEFT ((a), (s)); \
 (a) += (b); \
  }

Definition at line 79 of file md5transform.cpp.

Referenced by MD5Transform().

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

Definition at line 59 of file md5transform.cpp.

#define S11   7
 

Definition at line 31 of file md5transform.cpp.

#define S12   12
 

Definition at line 32 of file md5transform.cpp.

#define S13   17
 

Definition at line 33 of file md5transform.cpp.

#define S14   22
 

Definition at line 34 of file md5transform.cpp.

#define S21   5
 

Definition at line 35 of file md5transform.cpp.

#define S22   9
 

Definition at line 36 of file md5transform.cpp.

#define S23   14
 

Definition at line 37 of file md5transform.cpp.

#define S24   20
 

Definition at line 38 of file md5transform.cpp.

#define S31   4
 

Definition at line 39 of file md5transform.cpp.

#define S32   11
 

Definition at line 40 of file md5transform.cpp.

#define S33   16
 

Definition at line 41 of file md5transform.cpp.

#define S34   23
 

Definition at line 42 of file md5transform.cpp.

#define S41   6
 

Definition at line 43 of file md5transform.cpp.

Referenced by MD5Transform().

#define S42   10
 

Definition at line 44 of file md5transform.cpp.

Referenced by MD5Transform().

#define S43   15
 

Definition at line 45 of file md5transform.cpp.

Referenced by MD5Transform().

#define S44   21
 

Definition at line 46 of file md5transform.cpp.

Referenced by MD5Transform().


Function Documentation

static void Decode uint32_t *  output,
const unsigned char *  input,
unsigned int  len
[static]
 

Decodes input (unsigned char) into output (UINT4).

Assumes len is a multiple of 4.

Definition at line 104 of file md5transform.cpp.

static void Encode unsigned char *  output,
uint32_t *  input,
uint32_t  len
[static]
 

Encodes input (UINT4) into output (unsigned char).

Assumes len is a multiple of 4.

Definition at line 89 of file md5transform.cpp.

static void MD5Transform uint32_t  state[4],
const unsigned char  block[64]
[static]
 

Definition at line 119 of file md5transform.cpp.

References Decode(), FF, GG, HH, II, S11, S12, S13, S14, S21, S22, S23, S24, S31, S32, S33, S34, S41, S42, S43, and S44.

Referenced by Md5Transform::sumUp().

Here is the call graph for this function:


Variable Documentation

const uint8_t padding[64] = { 0x80 } [static]
 

Definition at line 48 of file md5transform.cpp.

Referenced by Md5Transform::getHash().