#include "rmd160.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
|
| #define | _DIAGASSERT(cond) assert(cond) |
| |
| #define | BYTES_TO_DWORD(strptr) |
| |
| #define | ROL(x, n) (((x) << (n)) | ((x) >> (32-(n)))) |
| |
| #define | F(x, y, z) ((x) ^ (y) ^ (z)) |
| |
| #define | G(x, y, z) (((x) & (y)) | (~(x) & (z))) |
| |
| #define | H(x, y, z) (((x) | ~(y)) ^ (z)) |
| |
| #define | I(x, y, z) (((x) & (z)) | ((y) & ~(z))) |
| |
| #define | J(x, y, z) ((x) ^ ((y) | ~(z))) |
| |
| #define | FF(a, b, c, d, e, x, s) |
| |
| #define | GG(a, b, c, d, e, x, s) |
| |
| #define | HH(a, b, c, d, e, x, s) |
| |
| #define | II(a, b, c, d, e, x, s) |
| |
| #define | JJ(a, b, c, d, e, x, s) |
| |
| #define | FFF(a, b, c, d, e, x, s) |
| |
| #define | GGG(a, b, c, d, e, x, s) |
| |
| #define | HHH(a, b, c, d, e, x, s) |
| |
| #define | III(a, b, c, d, e, x, s) |
| |
| #define | JJJ(a, b, c, d, e, x, s) |
| |
◆ _DIAGASSERT
| #define _DIAGASSERT |
( |
|
cond | ) |
assert(cond) |
◆ BYTES_TO_DWORD
| #define BYTES_TO_DWORD |
( |
|
strptr | ) |
|
| #define F |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| ((x) ^ (y) ^ (z)) |
◆ FF
| #define FF |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
x, |
|
|
|
s |
|
) |
| |
Value: { \
(a) +=
F((b), (
c), (d)) + (x); \
(a) =
ROL((a), (
s)) + (e); \
}
Definition at line 74 of file rmd160.c.
◆ FFF
| #define FFF |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
x, |
|
|
|
s |
|
) |
| |
Value: { \
(a) +=
F((b), (
c), (d)) + (x); \
(a) =
ROL((a), (
s)) + (e); \
}
Definition at line 99 of file rmd160.c.
| #define G |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| (((x) & (y)) | (~(x) & (z))) |
◆ GG
| #define GG |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
x, |
|
|
|
s |
|
) |
| |
Value: { \
(a) +=
G((b), (
c), (d)) + (x) + 0x5a827999
U; \
(a) =
ROL((a), (
s)) + (e); \
}
Definition at line 79 of file rmd160.c.
◆ GGG
| #define GGG |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
x, |
|
|
|
s |
|
) |
| |
Value: { \
(a) +=
G((b), (
c), (d)) + (x) + 0x7a6d76e9
U; \
(a) =
ROL((a), (
s)) + (e); \
}
Definition at line 104 of file rmd160.c.
| #define H |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| (((x) | ~(y)) ^ (z)) |
◆ HH
| #define HH |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
x, |
|
|
|
s |
|
) |
| |
Value: { \
(a) +=
H((b), (
c), (d)) + (x) + 0x6ed9eba1
U; \
(a) =
ROL((a), (
s)) + (e); \
}
Definition at line 84 of file rmd160.c.
◆ HHH
| #define HHH |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
x, |
|
|
|
s |
|
) |
| |
Value: { \
(a) +=
H((b), (
c), (d)) + (x) + 0x6d703ef3
U; \
(a) =
ROL((a), (
s)) + (e); \
}
Definition at line 109 of file rmd160.c.
| #define I |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| (((x) & (z)) | ((y) & ~(z))) |
◆ II
| #define II |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
x, |
|
|
|
s |
|
) |
| |
Value: { \
(a) +=
I((b), (
c), (d)) + (x) + 0x8f1bbcdc
U; \
(a) =
ROL((a), (
s)) + (e); \
}
Definition at line 89 of file rmd160.c.
◆ III
| #define III |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
x, |
|
|
|
s |
|
) |
| |
Value: { \
(a) +=
I((b), (
c), (d)) + (x) + 0x5c4dd124
U; \
(a) =
ROL((a), (
s)) + (e); \
}
Definition at line 114 of file rmd160.c.
| #define J |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| ((x) ^ ((y) | ~(z))) |
◆ JJ
| #define JJ |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
x, |
|
|
|
s |
|
) |
| |
Value: { \
(a) +=
J((b), (
c), (d)) + (x) + 0xa953fd4e
U; \
(a) =
ROL((a), (
s)) + (e); \
}
Definition at line 94 of file rmd160.c.
◆ JJJ
| #define JJJ |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
x, |
|
|
|
s |
|
) |
| |
Value: { \
(a) +=
J((b), (
c), (d)) + (x) + 0x50a28be6
U; \
(a) =
ROL((a), (
s)) + (e); \
}
Definition at line 119 of file rmd160.c.
◆ ROL
| #define ROL |
( |
|
x, |
|
|
|
n |
|
) |
| (((x) << (n)) | ((x) >> (32-(n)))) |
◆ RMD160_Finish()
Definition at line 417 of file rmd160.c.
References _DIAGASSERT, RMD160_CTX::bbuffer, RMD160_CTX::buflen, BYTES_TO_DWORD, i, RMD160_CTX::length, memcpy(), memset(), NULL, RMD160_Transform(), RMD160_CTX::state, and void.
◆ RMD160_Init()
◆ RMD160_Transform()
Definition at line 147 of file rmd160.c.
References _DIAGASSERT, cc, FF, FFF, GG, GGG, HH, HHH, II, III, JJ, JJJ, and NULL.
Referenced by RMD160_Finish(), and RMD160_Update().
◆ RMD160_Update()
Definition at line 353 of file rmd160.c.
References _DIAGASSERT, RMD160_CTX::bbuffer, RMD160_CTX::buflen, BYTES_TO_DWORD, i, RMD160_CTX::length, memcpy(), memset(), NULL, RMD160_Transform(), RMD160_CTX::state, and void.