#include <inttypes.h>
Go to the source code of this file.
|
#define | ROTATELEFT32(x, s) (((x) << (s)) | ((x) >> (32 - (s)))) |
|
#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 | S(a, b, c, d, k, s) |
|
#define | T(a, b, c, d, k, s) |
|
#define | U(a, b, c, d, k, s) |
|
|
static uint32_t | X [16] |
|
static uint32_t | A |
|
static uint32_t | AA |
|
static uint32_t | B |
|
static uint32_t | BB |
|
static uint32_t | C |
|
static uint32_t | CC |
|
static uint32_t | D |
|
static uint32_t | DD |
|
#define F |
( |
|
X, |
|
|
|
Y, |
|
|
|
Z |
|
) |
| (((X)&(Y)) | ((~X) & (Z))) |
Definition at line 13 of file md4.c.
#define G |
( |
|
X, |
|
|
|
Y, |
|
|
|
Z |
|
) |
| (((X)&(Y)) | ((X)&(Z)) | ((Y)&(Z))) |
Definition at line 14 of file md4.c.
#define H |
( |
|
X, |
|
|
|
Y, |
|
|
|
Z |
|
) |
| ((X) ^ (Y) ^ (Z)) |
Definition at line 15 of file md4.c.
◆ ROTATELEFT32
#define ROTATELEFT32 |
( |
|
x, |
|
|
|
s |
|
) |
| (((x) << (s)) | ((x) >> (32 - (s)))) |
Definition at line 11 of file md4.c.
#define S |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
k, |
|
|
|
s |
|
) |
| |
Value: { \
a += (
F((b), (c), (d)) +
X[(k)]); \
}
Definition at line 17 of file md4.c.
#define T |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
k, |
|
|
|
s |
|
) |
| |
Value: { \
a += (
G((b), (c), (d)) +
X[(k)] + 0x5A827999); \
}
Definition at line 22 of file md4.c.
#define U |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
k, |
|
|
|
s |
|
) |
| |
Value: { \
a += (
H((b), (c), (d)) +
X[(k)] + 0x6ED9EBA1); \
}
Definition at line 27 of file md4.c.
◆ Com_BlockChecksum()
unsigned Com_BlockChecksum |
( |
void * |
buffer, |
|
|
int |
length |
|
) |
| |
◆ DoMD4()
Definition at line 40 of file md4.c.
57 S(
C,
D,
A,
B, 10, 11);
58 S(
B,
C,
D,
A, 11, 19);
61 S(
C,
D,
A,
B, 14, 11);
62 S(
B,
C,
D,
A, 15, 19);
67 T(
B,
C,
D,
A, 12, 13);
71 T(
B,
C,
D,
A, 13, 13);
75 T(
B,
C,
D,
A, 14, 13);
79 T(
B,
C,
D,
A, 15, 13);
84 U(
B,
C,
D,
A, 12, 15);
88 U(
B,
C,
D,
A, 14, 15);
92 U(
B,
C,
D,
A, 13, 15);
96 U(
B,
C,
D,
A, 15, 15);
Referenced by PerformMD4().
◆ PerformMD4()
static void PerformMD4 |
( |
const unsigned char * |
buf, |
|
|
int |
length, |
|
|
unsigned char * |
digest |
|
) |
| |
|
static |
Definition at line 105 of file md4.c.
107 int len = length / 64;
108 int rem = length % 64;
111 const unsigned char *ptr = buf;
119 for (
i = 0;
i < len;
i++)
121 for (
j = 0;
j < 16;
j++)
123 X[
j] = ((ptr[0] << 0) | (ptr[1] << 8) |
124 (ptr[2] << 16) | (ptr[3] << 24));
134 for (
j = 0;
j <
i;
j++)
136 X[
j] = ((ptr[0] << 0) | (ptr[1] << 8) |
137 (ptr[2] << 16) | (ptr[3] << 24));
148 X[
j] = ((ptr[0] << 0) | ((0x80U) << 8));
151 X[
j] = ((ptr[0] << 0) | (ptr[1] << 8) | ((0x80
U) << 16));
156 0) | (ptr[1] << 8) | (ptr[2] << 16) | ((0x80U) << 24));
179 X[14] = (length & 0x1FFFFFFF) << 3;
180 X[15] = (length & ~0x1FFFFFFF) >> 29;
184 digest[0] = (
A & 0x000000FF) >> 0;
185 digest[1] = (
A & 0x0000FF00) >> 8;
186 digest[2] = (
A & 0x00FF0000) >> 16;
187 digest[3] = (
A & 0xFF000000) >> 24;
188 digest[4] = (
B & 0x000000FF) >> 0;
189 digest[5] = (
B & 0x0000FF00) >> 8;
190 digest[6] = (
B & 0x00FF0000) >> 16;
191 digest[7] = (
B & 0xFF000000) >> 24;
192 digest[8] = (
C & 0x000000FF) >> 0;
193 digest[9] = (
C & 0x0000FF00) >> 8;
194 digest[10] = (
C & 0x00FF0000) >> 16;
195 digest[11] = (
C & 0xFF000000) >> 24;
196 digest[12] = (
D & 0x000000FF) >> 0;
197 digest[13] = (
D & 0x0000FF00) >> 8;
198 digest[14] = (
D & 0x00FF0000) >> 16;
199 digest[15] = (
D & 0xFF000000) >> 24;
206 for (
j = 0;
j < 16;
j++)
Referenced by Com_BlockChecksum().
◆ AA
◆ BB
◆ CC
◆ DD