Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Macros | Functions
rmd160.c File Reference
`#include "rmd160.h"`
`#include <assert.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
Include dependency graph for rmd160.c:

Go to the source code of this file.

## Macros
#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)

## Functions
void | RMD160_Init (RMD160_CTX *context)
void | RMD160_Transform (uint32_t state[5], const uint32_t block[16])
void | RMD160_Update (RMD160_CTX *context, const uint8_t *data, size_t nbytes)
void | RMD160_Finish (RMD160_CTX *context, uint8_t digest[20])

## Macro Definition Documentation

#define _DIAGASSERT | ( |  | cond | ) | assert(cond)

Definition at line 47 of file rmd160.c.

Referenced by RMD160_Finish(), RMD160_Init(), RMD160_Transform(), and RMD160_Update().

#define BYTES_TO_DWORD | ( |  | strptr | ) |

Value:
(((uint32_t) *((strptr)+3) << 24) | \
((uint32_t) *((strptr)+2) << 16) | \
((uint32_t) *((strptr)+1) << 8) | \
((uint32_t) *(strptr)))
uint32_t
unsigned int uint32_t
Definition: sha2.h:101

Definition at line 56 of file rmd160.c.

Referenced by RMD160_Finish(), and RMD160_Update().

#define F | ( |  | x,
|  |  | y,
|  |  | z
| ) |  | ((x) ^ (y) ^ (z))

Definition at line 67 of file rmd160.c.

#define FF | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | x,
|  |  | s
| ) |  |

Value:
{ \
(a) += F((b), (c), (d)) + (x); \
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
a
Real * a
Definition: bigdecimal.c:1182
ROL
#define ROL(x, n)
Definition: rmd160.c:64
d
d
Definition: strlcat.c:58
s
register char * s
Definition: os2.c:56
b
Real * b
Definition: bigdecimal.c:1182
c
VpDivd * c
Definition: bigdecimal.c:1205
e
BDIGIT e
Definition: bigdecimal.c:5085
F
#define F(x, y, z)
Definition: rmd160.c:67

Definition at line 74 of file rmd160.c.

Referenced by RMD160_Transform().

#define FFF | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | x,
|  |  | s
| ) |  |

Value:
{ \
(a) += F((b), (c), (d)) + (x); \
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
a
Real * a
Definition: bigdecimal.c:1182
ROL
#define ROL(x, n)
Definition: rmd160.c:64
d
d
Definition: strlcat.c:58
s
register char * s
Definition: os2.c:56
b
Real * b
Definition: bigdecimal.c:1182
c
VpDivd * c
Definition: bigdecimal.c:1205
e
BDIGIT e
Definition: bigdecimal.c:5085
F
#define F(x, y, z)
Definition: rmd160.c:67

Definition at line 99 of file rmd160.c.

Referenced by RMD160_Transform().

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

Definition at line 68 of file rmd160.c.

#define GG | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | x,
|  |  | s
| ) |  |

Value:
{ \
(a) += G((b), (c), (d)) + (x) + 0x5a827999U; \
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
a
Real * a
Definition: bigdecimal.c:1182
G
#define G(x, y, z)
Definition: rmd160.c:68
ROL
#define ROL(x, n)
Definition: rmd160.c:64
d
d
Definition: strlcat.c:58
U
Definition: util.c:789
s
register char * s
Definition: os2.c:56
b
Real * b
Definition: bigdecimal.c:1182
c
VpDivd * c
Definition: bigdecimal.c:1205
e
BDIGIT e
Definition: bigdecimal.c:5085

Definition at line 79 of file rmd160.c.

Referenced by RMD160_Transform().

#define GGG | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | x,
|  |  | s
| ) |  |

Value:
{ \
(a) += G((b), (c), (d)) + (x) + 0x7a6d76e9U; \
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
a
Real * a
Definition: bigdecimal.c:1182
G
#define G(x, y, z)
Definition: rmd160.c:68
ROL
#define ROL(x, n)
Definition: rmd160.c:64
d
d
Definition: strlcat.c:58
U
Definition: util.c:789
s
register char * s
Definition: os2.c:56
b
Real * b
Definition: bigdecimal.c:1182
c
VpDivd * c
Definition: bigdecimal.c:1205
e
BDIGIT e
Definition: bigdecimal.c:5085

Definition at line 104 of file rmd160.c.

Referenced by RMD160_Transform().

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

Definition at line 69 of file rmd160.c.

#define HH | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | x,
|  |  | s
| ) |  |

Value:
{ \
(a) += H((b), (c), (d)) + (x) + 0x6ed9eba1U; \
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
a
Real * a
Definition: bigdecimal.c:1182
H
#define H(x, y, z)
Definition: rmd160.c:69
ROL
#define ROL(x, n)
Definition: rmd160.c:64
d
d
Definition: strlcat.c:58
U
Definition: util.c:789
s
register char * s
Definition: os2.c:56
b
Real * b
Definition: bigdecimal.c:1182
c
VpDivd * c
Definition: bigdecimal.c:1205
e
BDIGIT e
Definition: bigdecimal.c:5085

Definition at line 84 of file rmd160.c.

Referenced by RMD160_Transform().

#define HHH | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | x,
|  |  | s
| ) |  |

Value:
{ \
(a) += H((b), (c), (d)) + (x) + 0x6d703ef3U; \
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
a
Real * a
Definition: bigdecimal.c:1182
H
#define H(x, y, z)
Definition: rmd160.c:69
ROL
#define ROL(x, n)
Definition: rmd160.c:64
d
d
Definition: strlcat.c:58
U
Definition: util.c:789
s
register char * s
Definition: os2.c:56
b
Real * b
Definition: bigdecimal.c:1182
c
VpDivd * c
Definition: bigdecimal.c:1205
e
BDIGIT e
Definition: bigdecimal.c:5085

Definition at line 109 of file rmd160.c.

Referenced by RMD160_Transform().

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

Definition at line 70 of file rmd160.c.

#define II | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | x,
|  |  | s
| ) |  |

Value:
{ \
(a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcU; \
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
a
Real * a
Definition: bigdecimal.c:1182
ROL
#define ROL(x, n)
Definition: rmd160.c:64
d
d
Definition: strlcat.c:58
U
Definition: util.c:789
s
register char * s
Definition: os2.c:56
I
#define I(x, y, z)
Definition: rmd160.c:70
b
Real * b
Definition: bigdecimal.c:1182
c
VpDivd * c
Definition: bigdecimal.c:1205
e
BDIGIT e
Definition: bigdecimal.c:5085

Definition at line 89 of file rmd160.c.

Referenced by RMD160_Transform().

#define III | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | x,
|  |  | s
| ) |  |

Value:
{ \
(a) += I((b), (c), (d)) + (x) + 0x5c4dd124U; \
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
a
Real * a
Definition: bigdecimal.c:1182
ROL
#define ROL(x, n)
Definition: rmd160.c:64
d
d
Definition: strlcat.c:58
U
Definition: util.c:789
s
register char * s
Definition: os2.c:56
I
#define I(x, y, z)
Definition: rmd160.c:70
b
Real * b
Definition: bigdecimal.c:1182
c
VpDivd * c
Definition: bigdecimal.c:1205
e
BDIGIT e
Definition: bigdecimal.c:5085

Definition at line 114 of file rmd160.c.

Referenced by RMD160_Transform().

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

Definition at line 71 of file rmd160.c.

#define JJ | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | x,
|  |  | s
| ) |  |

Value:
{ \
(a) += J((b), (c), (d)) + (x) + 0xa953fd4eU; \
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
a
Real * a
Definition: bigdecimal.c:1182
J
#define J(x, y, z)
Definition: rmd160.c:71
ROL
#define ROL(x, n)
Definition: rmd160.c:64
d
d
Definition: strlcat.c:58
U
Definition: util.c:789
s
register char * s
Definition: os2.c:56
b
Real * b
Definition: bigdecimal.c:1182
c
VpDivd * c
Definition: bigdecimal.c:1205
e
BDIGIT e
Definition: bigdecimal.c:5085

Definition at line 94 of file rmd160.c.

Referenced by RMD160_Transform().

#define JJJ | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | x,
|  |  | s
| ) |  |

Value:
{ \
(a) += J((b), (c), (d)) + (x) + 0x50a28be6U; \
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
a
Real * a
Definition: bigdecimal.c:1182
J
#define J(x, y, z)
Definition: rmd160.c:71
ROL
#define ROL(x, n)
Definition: rmd160.c:64
d
d
Definition: strlcat.c:58
U
Definition: util.c:789
s
register char * s
Definition: os2.c:56
b
Real * b
Definition: bigdecimal.c:1182
c
VpDivd * c
Definition: bigdecimal.c:1205
e
BDIGIT e
Definition: bigdecimal.c:5085

Definition at line 119 of file rmd160.c.

Referenced by RMD160_Transform().

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

Definition at line 64 of file rmd160.c.

## Function Documentation

void RMD160_Finish | ( | RMD160_CTX * | context,
|  | uint8_t | digest[20]
| ) |  |

Definition at line 416 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.

void RMD160_Init | ( | RMD160_CTX * | context | ) |

Definition at line 128 of file rmd160.c.

References _DIAGASSERT, RMD160_CTX::buflen, RMD160_CTX::length, NULL, and RMD160_CTX::state.

void RMD160_Transform | ( | uint32_t | state[5],
|  | const uint32_t | block[16]
| ) |  |

Definition at line 146 of file rmd160.c.

References _DIAGASSERT, FF, FFF, GG, GGG, HH, HHH, II, III, JJ, JJJ, and NULL.

Referenced by RMD160_Finish(), and RMD160_Update().

void RMD160_Update | ( | RMD160_CTX * | context,
|  | const uint8_t * | data,
|  | size_t | nbytes
| ) |  |

Definition at line 352 of file rmd160.c.

References _DIAGASSERT, RMD160_CTX::bbuffer, RMD160_CTX::buflen, BYTES_TO_DWORD, i, RMD160_CTX::length, length, memcpy(), memset(), NULL, RMD160_Transform(), RMD160_CTX::state, and void.