FFmpeg  4.3
Data Structures | Macros | Functions | Variables
ripemd.c File Reference
#include <string.h>
#include "attributes.h"
#include "avutil.h"
#include "bswap.h"
#include "intreadwrite.h"
#include "ripemd.h"
#include "mem.h"

Go to the source code of this file.

Data Structures

struct  AVRIPEMD
 hash context More...
 

Macros

#define rol(value, bits)   (((value) << (bits)) | ((value) >> (32 - (bits))))
 
#define ROUND128_0_TO_15(a, b, c, d, e, f, g, h)
 
#define ROUND128_16_TO_31(a, b, c, d, e, f, g, h)
 
#define ROUND128_32_TO_47(a, b, c, d, e, f, g, h)
 
#define ROUND128_48_TO_63(a, b, c, d, e, f, g, h)
 
#define R128_0
 
#define R128_16
 
#define R128_32
 
#define R128_48
 
#define ROTATE(x, y)
 
#define ROUND160_0_TO_15(a, b, c, d, e, f, g, h, i, j)
 
#define ROUND160_16_TO_31(a, b, c, d, e, f, g, h, i, j)
 
#define ROUND160_32_TO_47(a, b, c, d, e, f, g, h, i, j)
 
#define ROUND160_48_TO_63(a, b, c, d, e, f, g, h, i, j)
 
#define ROUND160_64_TO_79(a, b, c, d, e, f, g, h, i, j)
 
#define R160_0
 
#define R160_16
 
#define R160_32
 
#define R160_48
 
#define R160_64
 

Functions

struct AVRIPEMDav_ripemd_alloc (void)
 Allocate an AVRIPEMD context. More...
 
static void ripemd128_transform (uint32_t *state, const uint8_t buffer[64])
 
static void ripemd256_transform (uint32_t *state, const uint8_t buffer[64])
 
static void ripemd160_transform (uint32_t *state, const uint8_t buffer[64])
 
static void ripemd320_transform (uint32_t *state, const uint8_t buffer[64])
 
av_cold int av_ripemd_init (AVRIPEMD *ctx, int bits)
 Initialize RIPEMD hashing. More...
 
void av_ripemd_update (AVRIPEMD *ctx, const uint8_t *data, unsigned int len)
 Update hash value. More...
 
void av_ripemd_final (AVRIPEMD *ctx, uint8_t *digest)
 Finish hashing and output digest value. More...
 

Variables

const int av_ripemd_size = sizeof(AVRIPEMD)
 
static const uint32_t KA [4]
 
static const uint32_t KB [4]
 
static const int ROTA [80]
 
static const int ROTB [80]
 
static const int WA [80]
 
static const int WB [80]
 

Macro Definition Documentation

◆ rol

#define rol (   value,
  bits 
)    (((value) << (bits)) | ((value) >> (32 - (bits))))

Definition at line 88 of file ripemd.c.

◆ ROUND128_0_TO_15

#define ROUND128_0_TO_15 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)
Value:
a = rol(a + (( b ^ c ^ d) + block[WA[n]]), ROTA[n]); \
e = rol(e + ((((f ^ g) & h) ^ g) + block[WB[n]] + KB[0]), ROTB[n]); \
n++

Definition at line 90 of file ripemd.c.

◆ ROUND128_16_TO_31

#define ROUND128_16_TO_31 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)
Value:
a = rol(a + ((((c ^ d) & b) ^ d) + block[WA[n]] + KA[0]), ROTA[n]); \
e = rol(e + (((~g | f) ^ h) + block[WB[n]] + KB[1]), ROTB[n]); \
n++

Definition at line 95 of file ripemd.c.

◆ ROUND128_32_TO_47

#define ROUND128_32_TO_47 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)
Value:
a = rol(a + (((~c | b) ^ d) + block[WA[n]] + KA[1]), ROTA[n]); \
e = rol(e + ((((g ^ h) & f) ^ h) + block[WB[n]] + KB[2]), ROTB[n]); \
n++

Definition at line 100 of file ripemd.c.

◆ ROUND128_48_TO_63

#define ROUND128_48_TO_63 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)
Value:
a = rol(a + ((((b ^ c) & d) ^ c) + block[WA[n]] + KA[2]), ROTA[n]); \
e = rol(e + (( f ^ g ^ h) + block[WB[n]]), ROTB[n]); \
n++

Definition at line 105 of file ripemd.c.

◆ R128_0

#define R128_0
Value:
ROUND128_0_TO_15(a,b,c,d,e,f,g,h); \
ROUND128_0_TO_15(d,a,b,c,h,e,f,g); \
ROUND128_0_TO_15(c,d,a,b,g,h,e,f); \
ROUND128_0_TO_15(b,c,d,a,f,g,h,e)

Definition at line 110 of file ripemd.c.

◆ R128_16

#define R128_16
Value:
ROUND128_16_TO_31(d,a,b,c,h,e,f,g); \
ROUND128_16_TO_31(c,d,a,b,g,h,e,f); \
ROUND128_16_TO_31(b,c,d,a,f,g,h,e)

Definition at line 116 of file ripemd.c.

◆ R128_32

#define R128_32
Value:
ROUND128_32_TO_47(d,a,b,c,h,e,f,g); \
ROUND128_32_TO_47(c,d,a,b,g,h,e,f); \
ROUND128_32_TO_47(b,c,d,a,f,g,h,e)

Definition at line 122 of file ripemd.c.

◆ R128_48

#define R128_48
Value:
ROUND128_48_TO_63(d,a,b,c,h,e,f,g); \
ROUND128_48_TO_63(c,d,a,b,g,h,e,f); \
ROUND128_48_TO_63(b,c,d,a,f,g,h,e)

Definition at line 128 of file ripemd.c.

◆ ROTATE

#define ROTATE (   x,
 
)
Value:
x = rol(x, 10); \
y = rol(y, 10); \
n++

Definition at line 251 of file ripemd.c.

◆ ROUND160_0_TO_15

#define ROUND160_0_TO_15 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
 
)
Value:
a = rol(a + (( b ^ c ^ d) + block[WA[n]]), ROTA[n]) + e; \
f = rol(f + (((~i | h) ^ g) + block[WB[n]] + KB[0]), ROTB[n]) + j; \
ROTATE(c,h)

Definition at line 256 of file ripemd.c.

◆ ROUND160_16_TO_31

#define ROUND160_16_TO_31 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
 
)
Value:
a = rol(a + ((((c ^ d) & b) ^ d) + block[WA[n]] + KA[0]), ROTA[n]) + e; \
f = rol(f + ((((g ^ h) & i) ^ h) + block[WB[n]] + KB[1]), ROTB[n]) + j; \
ROTATE(c,h)

Definition at line 261 of file ripemd.c.

◆ ROUND160_32_TO_47

#define ROUND160_32_TO_47 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
 
)
Value:
a = rol(a + (((~c | b) ^ d) + block[WA[n]] + KA[1]), ROTA[n]) + e; \
f = rol(f + (((~h | g) ^ i) + block[WB[n]] + KB[2]), ROTB[n]) + j; \
ROTATE(c,h)

Definition at line 266 of file ripemd.c.

◆ ROUND160_48_TO_63

#define ROUND160_48_TO_63 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
 
)
Value:
a = rol(a + ((((b ^ c) & d) ^ c) + block[WA[n]] + KA[2]), ROTA[n]) + e; \
f = rol(f + ((((h ^ i) & g) ^ i) + block[WB[n]] + KB[3]), ROTB[n]) + j; \
ROTATE(c,h)

Definition at line 271 of file ripemd.c.

◆ ROUND160_64_TO_79

#define ROUND160_64_TO_79 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
 
)
Value:
a = rol(a + (((~d | c) ^ b) + block[WA[n]] + KA[3]), ROTA[n]) + e; \
f = rol(f + (( g ^ h ^ i) + block[WB[n]]), ROTB[n]) + j; \
ROTATE(c,h)

Definition at line 276 of file ripemd.c.

◆ R160_0

#define R160_0
Value:
ROUND160_0_TO_15(a,b,c,d,e,f,g,h,i,j); \
ROUND160_0_TO_15(e,a,b,c,d,j,f,g,h,i); \
ROUND160_0_TO_15(d,e,a,b,c,i,j,f,g,h); \
ROUND160_0_TO_15(c,d,e,a,b,h,i,j,f,g); \
ROUND160_0_TO_15(b,c,d,e,a,g,h,i,j,f)

Definition at line 281 of file ripemd.c.

◆ R160_16

#define R160_16
Value:
ROUND160_16_TO_31(e,a,b,c,d,j,f,g,h,i); \
ROUND160_16_TO_31(d,e,a,b,c,i,j,f,g,h); \
ROUND160_16_TO_31(c,d,e,a,b,h,i,j,f,g); \
ROUND160_16_TO_31(b,c,d,e,a,g,h,i,j,f); \
ROUND160_16_TO_31(a,b,c,d,e,f,g,h,i,j)

Definition at line 288 of file ripemd.c.

◆ R160_32

#define R160_32
Value:
ROUND160_32_TO_47(d,e,a,b,c,i,j,f,g,h); \
ROUND160_32_TO_47(c,d,e,a,b,h,i,j,f,g); \
ROUND160_32_TO_47(b,c,d,e,a,g,h,i,j,f); \
ROUND160_32_TO_47(a,b,c,d,e,f,g,h,i,j); \
ROUND160_32_TO_47(e,a,b,c,d,j,f,g,h,i)

Definition at line 295 of file ripemd.c.

◆ R160_48

#define R160_48
Value:
ROUND160_48_TO_63(c,d,e,a,b,h,i,j,f,g); \
ROUND160_48_TO_63(b,c,d,e,a,g,h,i,j,f); \
ROUND160_48_TO_63(a,b,c,d,e,f,g,h,i,j); \
ROUND160_48_TO_63(e,a,b,c,d,j,f,g,h,i); \
ROUND160_48_TO_63(d,e,a,b,c,i,j,f,g,h)

Definition at line 302 of file ripemd.c.

◆ R160_64

#define R160_64
Value:
ROUND160_64_TO_79(b,c,d,e,a,g,h,i,j,f); \
ROUND160_64_TO_79(a,b,c,d,e,f,g,h,i,j); \
ROUND160_64_TO_79(e,a,b,c,d,j,f,g,h,i); \
ROUND160_64_TO_79(d,e,a,b,c,i,j,f,g,h); \
ROUND160_64_TO_79(c,d,e,a,b,h,i,j,f,g)

Definition at line 309 of file ripemd.c.

Function Documentation

◆ ripemd128_transform()

static void ripemd128_transform ( uint32_t *  state,
const uint8_t  buffer[64] 
)
static

Definition at line 134 of file ripemd.c.

Referenced by av_ripemd_init().

◆ ripemd256_transform()

static void ripemd256_transform ( uint32_t *  state,
const uint8_t  buffer[64] 
)
static

Definition at line 191 of file ripemd.c.

Referenced by av_ripemd_init().

◆ ripemd160_transform()

static void ripemd160_transform ( uint32_t *  state,
const uint8_t  buffer[64] 
)
static

Definition at line 316 of file ripemd.c.

Referenced by av_ripemd_init().

◆ ripemd320_transform()

static void ripemd320_transform ( uint32_t *  state,
const uint8_t  buffer[64] 
)
static

Definition at line 388 of file ripemd.c.

Referenced by av_ripemd_init().

Variable Documentation

◆ KA

const uint32_t KA[4]
static
Initial value:
= {
0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e
}

Definition at line 48 of file ripemd.c.

◆ KB

const uint32_t KB[4]
static
Initial value:
= {
0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9
}

Definition at line 52 of file ripemd.c.

◆ ROTA

const int ROTA[80]
static
Initial value:
= {
11, 14, 15, 12, 5, 8, 7 , 9, 11, 13, 14, 15, 6, 7, 9, 8,
7 , 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
}

Definition at line 56 of file ripemd.c.

◆ ROTB

const int ROTB[80]
static
Initial value:
= {
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
}

Definition at line 64 of file ripemd.c.

◆ WA

const int WA[80]
static
Initial value:
= {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
}

Definition at line 72 of file ripemd.c.

◆ WB

const int WB[80]
static
Initial value:
= {
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
}

Definition at line 80 of file ripemd.c.

WA
static const int WA[80]
Definition: ripemd.c:72
ROUND160_64_TO_79
#define ROUND160_64_TO_79(a, b, c, d, e, f, g, h, i, j)
Definition: ripemd.c:276
KB
static const uint32_t KB[4]
Definition: ripemd.c:52
ROUND160_16_TO_31
#define ROUND160_16_TO_31(a, b, c, d, e, f, g, h, i, j)
Definition: ripemd.c:261
ROUND160_48_TO_63
#define ROUND160_48_TO_63(a, b, c, d, e, f, g, h, i, j)
Definition: ripemd.c:271
b
#define b
Definition: input.c:41
KA
static const uint32_t KA[4]
Definition: ripemd.c:48
x
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
Definition: fate.txt:150
ROTB
static const int ROTB[80]
Definition: ripemd.c:64
ROTA
static const int ROTA[80]
Definition: ripemd.c:56
rol
#define rol(value, bits)
Definition: ripemd.c:88
g
const char * g
Definition: vf_curves.c:115
ROUND128_32_TO_47
#define ROUND128_32_TO_47(a, b, c, d, e, f, g, h)
Definition: ripemd.c:100
ROUND128_0_TO_15
#define ROUND128_0_TO_15(a, b, c, d, e, f, g, h)
Definition: ripemd.c:90
f
#define f(width, name)
Definition: cbs_vp9.c:255
ROUND160_0_TO_15
#define ROUND160_0_TO_15(a, b, c, d, e, f, g, h, i, j)
Definition: ripemd.c:256
WB
static const int WB[80]
Definition: ripemd.c:80
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
ROUND128_48_TO_63
#define ROUND128_48_TO_63(a, b, c, d, e, f, g, h)
Definition: ripemd.c:105
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
ROUND160_32_TO_47
#define ROUND160_32_TO_47(a, b, c, d, e, f, g, h, i, j)
Definition: ripemd.c:266
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
h
h
Definition: vp9dsp_template.c:2038
ROUND128_16_TO_31
#define ROUND128_16_TO_31(a, b, c, d, e, f, g, h)
Definition: ripemd.c:95