md4transform.cpp File Reference


Detailed Description

Implementation of MD4 Checksumming Algorithm.

Definition in file md4transform.cpp.

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

Include dependency graph for md4transform.cpp:

Go to the source code of this file.


Defines

#define S11   3
#define S12   7
#define S13   11
#define S14   19
#define S21   3
#define S22   5
#define S23   9
#define S24   13
#define S31   3
#define S32   9
#define S33   11
#define S34   15
#define F(x, y, z)   (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z)   (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
#define H(x, y, z)   ((x) ^ (y) ^ (z))
#define ROL(x, n)   (((x) << (n)) | ((x) >> (32-(n))))
#define XX(f, a, b, c, d, x, n, s)   do { a+=f(b,c,d)+x+s; a=ROL(a,n); } while (0)
#define FF(a, b, c, d, x, n)   XX(F,a,b,c,d,x,n,0)
#define GG(a, b, c, d, x, n)   XX(G,a,b,c,d,x,n,(uint32_t)0x5a827999LU)
#define HH(a, b, c, d, x, n)   XX(H,a,b,c,d,x,n,(uint32_t)0x6ed9eba1LU)

Functions

static void Decode (uint32_t *output, const uint8_t *input, size_t len)
static void Encode (uint8_t *output, const uint32_t *input, size_t len)
static void MD4Transform (uint32_t state[4], const uint8_t block[64])

Variables

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

Define Documentation

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

Definition at line 67 of file md4transform.cpp.

#define FF a,
b,
c,
d,
x,
 )     XX(F,a,b,c,d,x,n,0)
 

Definition at line 79 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

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

Definition at line 68 of file md4transform.cpp.

#define GG a,
b,
c,
d,
x,
 )     XX(G,a,b,c,d,x,n,(uint32_t)0x5a827999LU)
 

Definition at line 80 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

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

Definition at line 69 of file md4transform.cpp.

#define HH a,
b,
c,
d,
x,
 )     XX(H,a,b,c,d,x,n,(uint32_t)0x6ed9eba1LU)
 

Definition at line 81 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

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

Definition at line 72 of file md4transform.cpp.

#define S11   3
 

Definition at line 51 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S12   7
 

Definition at line 52 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S13   11
 

Definition at line 53 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S14   19
 

Definition at line 54 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S21   3
 

Definition at line 55 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S22   5
 

Definition at line 56 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S23   9
 

Definition at line 57 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S24   13
 

Definition at line 58 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S31   3
 

Definition at line 59 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S32   9
 

Definition at line 60 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S33   11
 

Definition at line 61 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define S34   15
 

Definition at line 62 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

#define XX f,
a,
b,
c,
d,
x,
n,
 )     do { a+=f(b,c,d)+x+s; a=ROL(a,n); } while (0)
 

Definition at line 73 of file md4transform.cpp.


Function Documentation

static void Decode uint32_t *  output,
const uint8_t *  input,
size_t  len
[static]
 

Definition at line 28 of file md4transform.cpp.

Referenced by MD4Transform(), and MD5Transform().

static void Encode uint8_t *  output,
const uint32_t *  input,
size_t  len
[static]
 

Definition at line 39 of file md4transform.cpp.

Referenced by Md5Transform::getHash(), and Md4Transform::getHash().

static void MD4Transform uint32_t  state[4],
const uint8_t  block[64]
[static]
 

Definition at line 83 of file md4transform.cpp.

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

Referenced by Md4Transform::sumUp().

Here is the call graph for this function:


Variable Documentation

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

Definition at line 64 of file md4transform.cpp.

Referenced by Md4Transform::getHash().