RetroArch
Macros | Functions | Variables
ripemd160.c File Reference
#include "mbedtls/config.h"
#include "mbedtls/ripemd160.h"
#include <string.h>
#include "mbedtls/platform.h"
#include "arc4_alt.h"
Include dependency graph for ripemd160.c:

Macros

#define GET_UINT32_LE(n, b, i)
 
#define PUT_UINT32_LE(n, b, i)
 
#define F1(x, y, z)   ( x ^ y ^ z )
 
#define F2(x, y, z)   ( ( x & y ) | ( ~x & z ) )
 
#define F3(x, y, z)   ( ( x | ~y ) ^ z )
 
#define F4(x, y, z)   ( ( x & z ) | ( y & ~z ) )
 
#define F5(x, y, z)   ( x ^ ( y | ~z ) )
 
#define S(x, n)   ( ( x << n ) | ( x >> (32 - n) ) )
 
#define P(a, b, c, d, e, r, s, f, k)
 
#define P2(a, b, c, d, e, r, s, rp, sp)
 
#define F   F1
 
#define K   0x00000000
 
#define Fp   F5
 
#define Kp   0x50A28BE6
 
#define F   F2
 
#define K   0x5A827999
 
#define Fp   F4
 
#define Kp   0x5C4DD124
 
#define F   F3
 
#define K   0x6ED9EBA1
 
#define Fp   F3
 
#define Kp   0x6D703EF3
 
#define F   F4
 
#define K   0x8F1BBCDC
 
#define Fp   F2
 
#define Kp   0x7A6D76E9
 
#define F   F5
 
#define K   0xA953FD4E
 
#define Fp   F1
 
#define Kp   0x00000000
 
#define TESTS   8
 
#define KEYS   2
 

Functions

void mbedtls_ripemd160_init (mbedtls_ripemd160_context *ctx)
 Initialize RIPEMD-160 context. More...
 
void mbedtls_ripemd160_free (mbedtls_ripemd160_context *ctx)
 Clear RIPEMD-160 context. More...
 
void mbedtls_ripemd160_clone (mbedtls_ripemd160_context *dst, const mbedtls_ripemd160_context *src)
 Clone (the state of) an RIPEMD-160 context. More...
 
void mbedtls_ripemd160_starts (mbedtls_ripemd160_context *ctx)
 RIPEMD-160 context setup. More...
 
void mbedtls_ripemd160_process (mbedtls_ripemd160_context *ctx, const unsigned char data[64])
 
void mbedtls_ripemd160_update (mbedtls_ripemd160_context *ctx, const unsigned char *input, size_t ilen)
 RIPEMD-160 process buffer. More...
 
void mbedtls_ripemd160_finish (mbedtls_ripemd160_context *ctx, unsigned char output[20])
 RIPEMD-160 final digest. More...
 
void mbedtls_ripemd160 (const unsigned char *input, size_t ilen, unsigned char output[20])
 Output = RIPEMD-160( input buffer ) More...
 
int mbedtls_ripemd160_self_test (int verbose)
 Checkup routine. More...
 

Variables

static const unsigned char ripemd160_padding [64]
 
static const char * ripemd160_test_input [TESTS]
 
static const unsigned char ripemd160_test_md [TESTS][20]
 

Macro Definition Documentation

◆ F [1/5]

#define F   F1

◆ F [2/5]

#define F   F2

◆ F [3/5]

#define F   F3

◆ F [4/5]

#define F   F4

◆ F [5/5]

#define F   F5

◆ F1

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

◆ F2

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

◆ F3

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

◆ F4

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

◆ F5

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

◆ Fp [1/5]

#define Fp   F5

◆ Fp [2/5]

#define Fp   F4

◆ Fp [3/5]

#define Fp   F3

◆ Fp [4/5]

#define Fp   F2

◆ Fp [5/5]

#define Fp   F1

◆ GET_UINT32_LE

#define GET_UINT32_LE (   n,
  b,
 
)
Value:
{ \
(n) = ( (uint32_t) (b)[(i) ] ) \
| ( (uint32_t) (b)[(i) + 1] << 8 ) \
| ( (uint32_t) (b)[(i) + 2] << 16 ) \
| ( (uint32_t) (b)[(i) + 3] << 24 ); \
}
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
GLdouble n
Definition: glext.h:8396
unsigned int uint32_t
Definition: stdint.h:126

◆ K [1/5]

#define K   0x00000000

◆ K [2/5]

#define K   0x5A827999

◆ K [3/5]

#define K   0x6ED9EBA1

◆ K [4/5]

#define K   0x8F1BBCDC

◆ K [5/5]

#define K   0xA953FD4E

◆ KEYS

#define KEYS   2

◆ Kp [1/5]

#define Kp   0x50A28BE6

◆ Kp [2/5]

#define Kp   0x5C4DD124

◆ Kp [3/5]

#define Kp   0x6D703EF3

◆ Kp [4/5]

#define Kp   0x7A6D76E9

◆ Kp [5/5]

#define Kp   0x00000000

◆ P

#define P (   a,
  b,
  c,
  d,
  e,
  r,
  s,
  f,
 
)
Value:
a += f( b, c, d ) + X[r] + k; \
a = S( a, s ) + e; \
c = S( c, 10 );
GLdouble GLdouble GLdouble r
Definition: glext.h:6406
#define S(x, n)
GLfloat f
Definition: glext.h:8207
GLdouble s
Definition: glext.h:6390
const GLubyte * c
Definition: glext.h:9812
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
#define X(a, b)
Definition: bba.c:185
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ P2

#define P2 (   a,
  b,
  c,
  d,
  e,
  r,
  s,
  rp,
  sp 
)
Value:
P( a, b, c, d, e, r, s, F, K ); \
P( a ## p, b ## p, c ## p, d ## p, e ## p, rp, sp, Fp, Kp );
GLdouble GLdouble GLdouble r
Definition: glext.h:6406
GLdouble s
Definition: glext.h:6390
#define K
const GLubyte * c
Definition: glext.h:9812
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
#define Fp
GLfloat GLfloat p
Definition: glext.h:9809
#define Kp
#define P(a, b, c, d, e, r, s, f, k)
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844
#define F

◆ PUT_UINT32_LE

#define PUT_UINT32_LE (   n,
  b,
 
)
Value:
{ \
(b)[(i) ] = (unsigned char) ( ( (n) ) & 0xFF ); \
(b)[(i) + 1] = (unsigned char) ( ( (n) >> 8 ) & 0xFF ); \
(b)[(i) + 2] = (unsigned char) ( ( (n) >> 16 ) & 0xFF ); \
(b)[(i) + 3] = (unsigned char) ( ( (n) >> 24 ) & 0xFF ); \
}
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
GLdouble n
Definition: glext.h:8396

◆ S

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

◆ TESTS

#define TESTS   8

Function Documentation

◆ mbedtls_ripemd160()

void mbedtls_ripemd160 ( const unsigned char *  input,
size_t  ilen,
unsigned char  output[20] 
)

Output = RIPEMD-160( input buffer )

Parameters
inputbuffer holding the data
ilenlength of the input data
outputRIPEMD-160 checksum result
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_ripemd160_clone()

void mbedtls_ripemd160_clone ( mbedtls_ripemd160_context dst,
const mbedtls_ripemd160_context src 
)

Clone (the state of) an RIPEMD-160 context.

Parameters
dstThe destination context
srcThe context to be cloned
Here is the caller graph for this function:

◆ mbedtls_ripemd160_finish()

void mbedtls_ripemd160_finish ( mbedtls_ripemd160_context ctx,
unsigned char  output[20] 
)

RIPEMD-160 final digest.

Parameters
ctxRIPEMD-160 context
outputRIPEMD-160 checksum result
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_ripemd160_free()

void mbedtls_ripemd160_free ( mbedtls_ripemd160_context ctx)

Clear RIPEMD-160 context.

Parameters
ctxRIPEMD-160 context to be cleared
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_ripemd160_init()

void mbedtls_ripemd160_init ( mbedtls_ripemd160_context ctx)

Initialize RIPEMD-160 context.

Parameters
ctxRIPEMD-160 context to be initialized
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_ripemd160_process()

void mbedtls_ripemd160_process ( mbedtls_ripemd160_context ctx,
const unsigned char  data[64] 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_ripemd160_self_test()

int mbedtls_ripemd160_self_test ( int  verbose)

Checkup routine.

Returns
0 if successful, or 1 if the test failed
Here is the call graph for this function:

◆ mbedtls_ripemd160_starts()

void mbedtls_ripemd160_starts ( mbedtls_ripemd160_context ctx)

RIPEMD-160 context setup.

Parameters
ctxcontext to be initialized
Here is the caller graph for this function:

◆ mbedtls_ripemd160_update()

void mbedtls_ripemd160_update ( mbedtls_ripemd160_context ctx,
const unsigned char *  input,
size_t  ilen 
)

RIPEMD-160 process buffer.

Parameters
ctxRIPEMD-160 context
inputbuffer holding the data
ilenlength of the input data
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ ripemd160_padding

const unsigned char ripemd160_padding[64]
static
Initial value:
=
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}

◆ ripemd160_test_input

const char* ripemd160_test_input[TESTS]
static
Initial value:
=
{
"",
"a",
"abc",
"message digest",
"abcdefghijklmnopqrstuvwxyz",
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
"1234567890123456789012345678901234567890"
"1234567890123456789012345678901234567890",
}

◆ ripemd160_test_md

const unsigned char ripemd160_test_md[TESTS][20]
static
Initial value:
=
{
{ 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54, 0x61, 0x28,
0x08, 0x97, 0x7e, 0xe8, 0xf5, 0x48, 0xb2, 0x25, 0x8d, 0x31 },
{ 0x0b, 0xdc, 0x9d, 0x2d, 0x25, 0x6b, 0x3e, 0xe9, 0xda, 0xae,
0x34, 0x7b, 0xe6, 0xf4, 0xdc, 0x83, 0x5a, 0x46, 0x7f, 0xfe },
{ 0x8e, 0xb2, 0x08, 0xf7, 0xe0, 0x5d, 0x98, 0x7a, 0x9b, 0x04,
0x4a, 0x8e, 0x98, 0xc6, 0xb0, 0x87, 0xf1, 0x5a, 0x0b, 0xfc },
{ 0x5d, 0x06, 0x89, 0xef, 0x49, 0xd2, 0xfa, 0xe5, 0x72, 0xb8,
0x81, 0xb1, 0x23, 0xa8, 0x5f, 0xfa, 0x21, 0x59, 0x5f, 0x36 },
{ 0xf7, 0x1c, 0x27, 0x10, 0x9c, 0x69, 0x2c, 0x1b, 0x56, 0xbb,
0xdc, 0xeb, 0x5b, 0x9d, 0x28, 0x65, 0xb3, 0x70, 0x8d, 0xbc },
{ 0x12, 0xa0, 0x53, 0x38, 0x4a, 0x9c, 0x0c, 0x88, 0xe4, 0x05,
0xa0, 0x6c, 0x27, 0xdc, 0xf4, 0x9a, 0xda, 0x62, 0xeb, 0x2b },
{ 0xb0, 0xe2, 0x0b, 0x6e, 0x31, 0x16, 0x64, 0x02, 0x86, 0xed,
0x3a, 0x87, 0xa5, 0x71, 0x30, 0x79, 0xb2, 0x1f, 0x51, 0x89 },
{ 0x9b, 0x75, 0x2e, 0x45, 0x57, 0x3d, 0x4b, 0x39, 0xf4, 0xdb,
0xd3, 0x32, 0x3c, 0xab, 0x82, 0xbf, 0x63, 0x32, 0x6b, 0xfb },
}