#include "shared/shared.h"
#include "common/mdfour.h"
Go to the source code of this file.
|
#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 | lshift(x, s) (((x)<<(s)) | ((x)>>(32-(s)))) |
|
#define | ROUND1(a, b, c, d, k, s) a = lshift(a + F(b,c,d) + X[k], s) |
|
#define | ROUND2(a, b, c, d, k, s) a = lshift(a + G(b,c,d) + X[k] + 0x5A827999,s) |
|
#define | ROUND3(a, b, c, d, k, s) a = lshift(a + H(b,c,d) + X[k] + 0x6ED9EBA1,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)) |
◆ lshift
#define lshift |
( |
|
x, |
|
|
|
s |
|
) |
| (((x)<<(s)) | ((x)>>(32-(s)))) |
◆ ROUND1
#define ROUND1 |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
k, |
|
|
|
s |
|
) |
| a = lshift(a + F(b,c,d) + X[k], s) |
◆ ROUND2
#define ROUND2 |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
k, |
|
|
|
s |
|
) |
| a = lshift(a + G(b,c,d) + X[k] + 0x5A827999,s) |
◆ ROUND3
#define ROUND3 |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
k, |
|
|
|
s |
|
) |
| a = lshift(a + H(b,c,d) + X[k] + 0x6ED9EBA1,s) |
◆ Com_BlockChecksum()
uint32_t Com_BlockChecksum |
( |
void * |
buffer, |
|
|
size_t |
len |
|
) |
| |
Definition at line 187 of file mdfour.c.
197 val = digest[0] ^ digest[1] ^ digest[2] ^ digest[3];
Referenced by BSP_Load().
◆ copy4()
static void copy4 |
( |
uint8_t * |
out, |
|
|
uint32_t |
x |
|
) |
| |
|
static |
◆ copy64()
static void copy64 |
( |
uint32_t * |
M, |
|
|
uint8_t * |
in |
|
) |
| |
|
static |
Definition at line 101 of file mdfour.c.
105 for (i = 0; i < 16; i++)
106 M[i] = (in[i * 4 + 3] << 24) | (in[i * 4 + 2] << 16) |
107 (in[i * 4 + 1] << 8) | (in[i * 4 + 0] << 0);
Referenced by mdfour_tail(), and mdfour_update().
◆ mdfour64()
static void mdfour64 |
( |
uint32_t * |
M | ) |
|
|
static |
Definition at line 48 of file mdfour.c.
51 uint32_t AA, BB, CC, DD;
55 for (j = 0; j < 16; j++)
58 A =
m->A;
B =
m->B; C =
m->C; D =
m->D;
59 AA = A; BB =
B; CC = C; DD = D;
61 ROUND1(A,
B, C, D, 0, 3);
ROUND1(D, A,
B, C, 1, 7);
62 ROUND1(C, D, A,
B, 2, 11);
ROUND1(
B, C, D, A, 3, 19);
63 ROUND1(A,
B, C, D, 4, 3);
ROUND1(D, A,
B, C, 5, 7);
64 ROUND1(C, D, A,
B, 6, 11);
ROUND1(
B, C, D, A, 7, 19);
65 ROUND1(A,
B, C, D, 8, 3);
ROUND1(D, A,
B, C, 9, 7);
66 ROUND1(C, D, A,
B, 10, 11);
ROUND1(
B, C, D, A, 11, 19);
67 ROUND1(A,
B, C, D, 12, 3);
ROUND1(D, A,
B, C, 13, 7);
68 ROUND1(C, D, A,
B, 14, 11);
ROUND1(
B, C, D, A, 15, 19);
70 ROUND2(A,
B, C, D, 0, 3);
ROUND2(D, A,
B, C, 4, 5);
71 ROUND2(C, D, A,
B, 8, 9);
ROUND2(
B, C, D, A, 12, 13);
72 ROUND2(A,
B, C, D, 1, 3);
ROUND2(D, A,
B, C, 5, 5);
73 ROUND2(C, D, A,
B, 9, 9);
ROUND2(
B, C, D, A, 13, 13);
74 ROUND2(A,
B, C, D, 2, 3);
ROUND2(D, A,
B, C, 6, 5);
75 ROUND2(C, D, A,
B, 10, 9);
ROUND2(
B, C, D, A, 14, 13);
76 ROUND2(A,
B, C, D, 3, 3);
ROUND2(D, A,
B, C, 7, 5);
77 ROUND2(C, D, A,
B, 11, 9);
ROUND2(
B, C, D, A, 15, 13);
79 ROUND3(A,
B, C, D, 0, 3);
ROUND3(D, A,
B, C, 8, 9);
80 ROUND3(C, D, A,
B, 4, 11);
ROUND3(
B, C, D, A, 12, 15);
81 ROUND3(A,
B, C, D, 2, 3);
ROUND3(D, A,
B, C, 10, 9);
82 ROUND3(C, D, A,
B, 6, 11);
ROUND3(
B, C, D, A, 14, 15);
83 ROUND3(A,
B, C, D, 1, 3);
ROUND3(D, A,
B, C, 9, 9);
84 ROUND3(C, D, A,
B, 5, 11);
ROUND3(
B, C, D, A, 13, 15);
85 ROUND3(A,
B, C, D, 3, 3);
ROUND3(D, A,
B, C, 11, 9);
86 ROUND3(C, D, A,
B, 7, 11);
ROUND3(
B, C, D, A, 15, 15);
88 A += AA;
B += BB; C += CC; D += DD;
91 A &= 0xFFFFFFFF;
B &= 0xFFFFFFFF;
92 C &= 0xFFFFFFFF; D &= 0xFFFFFFFF;
95 for (j = 0; j < 16; j++)
98 m->A = A;
m->B =
B;
m->C = C;
m->D = D;
Referenced by mdfour_tail(), and mdfour_update().
◆ mdfour_begin()
void mdfour_begin |
( |
struct mdfour * |
md | ) |
|
◆ mdfour_result()
void mdfour_result |
( |
struct mdfour * |
md, |
|
|
uint8_t * |
out |
|
) |
| |
◆ mdfour_tail()
static void mdfour_tail |
( |
uint8_t * |
in, |
|
|
size_t |
n |
|
) |
| |
|
static |
◆ mdfour_update()
void mdfour_update |
( |
struct mdfour * |
md, |
|
|
uint8_t * |
in, |
|
|
size_t |
n |
|
) |
| |
Definition at line 32 of file mdfour.c.
Referenced by Cmd_Macro_g(), inverse(), mdfour64(), mdfour_result(), mdfour_tail(), mdfour_update(), Menu_AdjustCursor(), Menu_DefaultKey(), Menu_ItemAtCursor(), Prompt_CompleteHistory(), R_BeginRegistration_RTX(), R_CreateNotexture(), resolve_masters(), sample_polygonal_lights(), setup_color(), StringToFilter(), SV_FilterPacket(), SV_ListMasters_f(), SV_MasterHeartbeat(), SV_MasterShutdown(), SV_SetMaster_f(), SVC_Ack(), and vkpt_vertex_buffer_upload_models_to_staging().