ripemd160.c
Go to the documentation of this file.
1 /**
2  * @file ripemd160.c
3  * @brief RIPEMD-160 hash function
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneCrypto Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 //Switch to the appropriate trace level
30 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
31 
32 //Dependencies
33 #include "core/crypto.h"
34 #include "hash/ripemd160.h"
35 
36 //Check crypto library configuration
37 #if (RIPEMD160_SUPPORT == ENABLED)
38 
39 //RIPEMD-160 auxiliary functions
40 #define F(x, y, z) ((x) ^ (y) ^ (z))
41 #define G(x, y, z) (((x) & (y)) | (~(x) & (z)))
42 #define H(x, y, z) (((x) | ~(y)) ^ (z))
43 #define I(x, y, z) (((x) & (z)) | ((y) & ~(z)))
44 #define J(x, y, z) ((x) ^ ((y) | ~(z)))
45 
46 #define FF(a, b, c, d, e, x, s) a += F(b, c, d) + (x), a = ROL32(a, s) + (e), c = ROL32(c, 10)
47 #define GG(a, b, c, d, e, x, s) a += G(b, c, d) + (x) + 0x5A827999, a = ROL32(a, s) + (e), c = ROL32(c, 10)
48 #define HH(a, b, c, d, e, x, s) a += H(b, c, d) + (x) + 0x6ED9EBA1, a = ROL32(a, s) + (e), c = ROL32(c, 10)
49 #define II(a, b, c, d, e, x, s) a += I(b, c, d) + (x) + 0x8F1BBCDC, a = ROL32(a, s) + (e), c = ROL32(c, 10)
50 #define JJ(a, b, c, d, e, x, s) a += J(b, c, d) + (x) + 0xA953FD4E, a = ROL32(a, s) + (e), c = ROL32(c, 10)
51 
52 #define FFF(a, b, c, d, e, x, s) a += F(b, c, d) + (x), a = ROL32(a, s) + (e), c = ROL32(c, 10)
53 #define GGG(a, b, c, d, e, x, s) a += G(b, c, d) + (x) + 0x7A6D76E9, a = ROL32(a, s) + (e), c = ROL32(c, 10)
54 #define HHH(a, b, c, d, e, x, s) a += H(b, c, d) + (x) + 0x6D703EF3, a = ROL32(a, s) + (e), c = ROL32(c, 10)
55 #define III(a, b, c, d, e, x, s) a += I(b, c, d) + (x) + 0x5C4DD124, a = ROL32(a, s) + (e), c = ROL32(c, 10)
56 #define JJJ(a, b, c, d, e, x, s) a += J(b, c, d) + (x) + 0x50A28BE6, a = ROL32(a, s) + (e), c = ROL32(c, 10)
57 
58 //RIPEMD-160 padding
59 static const uint8_t padding[64] =
60 {
61  0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
65 };
66 
67 //RIPEMD-160 object identifier (1.3.36.3.2.1)
68 const uint8_t ripemd160Oid[5] = {0x2B, 0x24, 0x03, 0x02, 0x01};
69 
70 //Common interface for hash algorithms
72 {
73  "RIPEMD-160",
75  sizeof(ripemd160Oid),
76  sizeof(Ripemd160Context),
83 };
84 
85 
86 /**
87  * @brief Digest a message using RIPEMD-160
88  * @param[in] data Pointer to the message being hashed
89  * @param[in] length Length of the message
90  * @param[out] digest Pointer to the calculated digest
91  * @return Error code
92  **/
93 
94 error_t ripemd160Compute(const void *data, size_t length, uint8_t *digest)
95 {
96  //Allocate a memory buffer to hold the RIPEMD-160 context
98  //Failed to allocate memory?
99  if(context == NULL)
100  return ERROR_OUT_OF_MEMORY;
101 
102  //Initialize the RIPEMD-160 context
103  ripemd160Init(context);
104  //Digest the message
105  ripemd160Update(context, data, length);
106  //Finalize the RIPEMD-160 message digest
107  ripemd160Final(context, digest);
108 
109  //Free previously allocated memory
110  cryptoFreeMem(context);
111  //Successful processing
112  return NO_ERROR;
113 }
114 
115 
116 /**
117  * @brief Initialize RIPEMD-160 message digest context
118  * @param[in] context Pointer to the RIPEMD-160 context to initialize
119  **/
120 
122 {
123  //Set initial hash value
124  context->h[0] = 0x67452301;
125  context->h[1] = 0xEFCDAB89;
126  context->h[2] = 0x98BADCFE;
127  context->h[3] = 0x10325476;
128  context->h[4] = 0xC3D2E1F0;
129 
130  //Number of bytes in the buffer
131  context->size = 0;
132  //Total length of the message
133  context->totalSize = 0;
134 }
135 
136 
137 /**
138  * @brief Update the RIPEMD-160 context with a portion of the message being hashed
139  * @param[in] context Pointer to the RIPEMD-160 context
140  * @param[in] data Pointer to the buffer being hashed
141  * @param[in] length Length of the buffer
142  **/
143 
144 void ripemd160Update(Ripemd160Context *context, const void *data, size_t length)
145 {
146  size_t n;
147 
148  //Process the incoming data
149  while(length > 0)
150  {
151  //The buffer can hold at most 64 bytes
152  n = MIN(length, 64 - context->size);
153 
154  //Copy the data to the buffer
155  cryptoMemcpy(context->buffer + context->size, data, n);
156 
157  //Update the RIPEMD-160 context
158  context->size += n;
159  context->totalSize += n;
160  //Advance the data pointer
161  data = (uint8_t *) data + n;
162  //Remaining bytes to process
163  length -= n;
164 
165  //Process message in 16-word blocks
166  if(context->size == 64)
167  {
168  //Transform the 16-word block
169  ripemd160ProcessBlock(context);
170  //Empty the buffer
171  context->size = 0;
172  }
173  }
174 }
175 
176 
177 /**
178  * @brief Finish the RIPEMD-160 message digest
179  * @param[in] context Pointer to the RIPEMD-160 context
180  * @param[out] digest Calculated digest (optional parameter)
181  **/
182 
183 void ripemd160Final(Ripemd160Context *context, uint8_t *digest)
184 {
185  uint_t i;
186  size_t paddingSize;
187  uint64_t totalSize;
188 
189  //Length of the original message (before padding)
190  totalSize = context->totalSize * 8;
191 
192  //Pad the message so that its length is congruent to 56 modulo 64
193  if(context->size < 56)
194  paddingSize = 56 - context->size;
195  else
196  paddingSize = 64 + 56 - context->size;
197 
198  //Append padding
199  ripemd160Update(context, padding, paddingSize);
200 
201  //Append the length of the original message
202  context->x[14] = htole32((uint32_t) totalSize);
203  context->x[15] = htole32((uint32_t) (totalSize >> 32));
204 
205  //Calculate the message digest
206  ripemd160ProcessBlock(context);
207 
208  //Convert from host byte order to little-endian byte order
209  for(i = 0; i < 4; i++)
210  context->h[i] = htole32(context->h[i]);
211 
212  //Copy the resulting digest
213  if(digest != NULL)
214  cryptoMemcpy(digest, context->digest, RIPEMD160_DIGEST_SIZE);
215 }
216 
217 
218 /**
219  * @brief Process message in 16-word blocks
220  * @param[in] context Pointer to the RIPEMD-160 context
221  **/
222 
224 {
225  uint_t i;
226 
227  //Initialize the working registers
228  uint32_t aa= context->h[0];
229  uint32_t bb = context->h[1];
230  uint32_t cc = context->h[2];
231  uint32_t dd = context->h[3];
232  uint32_t ee = context->h[4];
233  uint32_t aaa = context->h[0];
234  uint32_t bbb = context->h[1];
235  uint32_t ccc = context->h[2];
236  uint32_t ddd = context->h[3];
237  uint32_t eee = context->h[4];
238 
239  //Process message in 16-word blocks
240  uint32_t *x = context->x;
241 
242  //Convert from little-endian byte order to host byte order
243  for(i = 0; i < 16; i++)
244  x[i] = letoh32(x[i]);
245 
246  //Round 1
247  FF(aa, bb, cc, dd, ee, x[0], 11);
248  FF(ee, aa, bb, cc, dd, x[1], 14);
249  FF(dd, ee, aa, bb, cc, x[2], 15);
250  FF(cc, dd, ee, aa, bb, x[3], 12);
251  FF(bb, cc, dd, ee, aa, x[4], 5);
252  FF(aa, bb, cc, dd, ee, x[5], 8);
253  FF(ee, aa, bb, cc, dd, x[6], 7);
254  FF(dd, ee, aa, bb, cc, x[7], 9);
255  FF(cc, dd, ee, aa, bb, x[8], 11);
256  FF(bb, cc, dd, ee, aa, x[9], 13);
257  FF(aa, bb, cc, dd, ee, x[10], 14);
258  FF(ee, aa, bb, cc, dd, x[11], 15);
259  FF(dd, ee, aa, bb, cc, x[12], 6);
260  FF(cc, dd, ee, aa, bb, x[13], 7);
261  FF(bb, cc, dd, ee, aa, x[14], 9);
262  FF(aa, bb, cc, dd, ee, x[15], 8);
263 
264  //Round 2
265  GG(ee, aa, bb, cc, dd, x[7], 7);
266  GG(dd, ee, aa, bb, cc, x[4], 6);
267  GG(cc, dd, ee, aa, bb, x[13], 8);
268  GG(bb, cc, dd, ee, aa, x[1], 13);
269  GG(aa, bb, cc, dd, ee, x[10], 11);
270  GG(ee, aa, bb, cc, dd, x[6], 9);
271  GG(dd, ee, aa, bb, cc, x[15], 7);
272  GG(cc, dd, ee, aa, bb, x[3], 15);
273  GG(bb, cc, dd, ee, aa, x[12], 7);
274  GG(aa, bb, cc, dd, ee, x[0], 12);
275  GG(ee, aa, bb, cc, dd, x[9], 15);
276  GG(dd, ee, aa, bb, cc, x[5], 9);
277  GG(cc, dd, ee, aa, bb, x[2], 11);
278  GG(bb, cc, dd, ee, aa, x[14], 7);
279  GG(aa, bb, cc, dd, ee, x[11], 13);
280  GG(ee, aa, bb, cc, dd, x[8], 12);
281 
282  //Round 3
283  HH(dd, ee, aa, bb, cc, x[3], 11);
284  HH(cc, dd, ee, aa, bb, x[10], 13);
285  HH(bb, cc, dd, ee, aa, x[14], 6);
286  HH(aa, bb, cc, dd, ee, x[4], 7);
287  HH(ee, aa, bb, cc, dd, x[9], 14);
288  HH(dd, ee, aa, bb, cc, x[15], 9);
289  HH(cc, dd, ee, aa, bb, x[8], 13);
290  HH(bb, cc, dd, ee, aa, x[1], 15);
291  HH(aa, bb, cc, dd, ee, x[2], 14);
292  HH(ee, aa, bb, cc, dd, x[7], 8);
293  HH(dd, ee, aa, bb, cc, x[0], 13);
294  HH(cc, dd, ee, aa, bb, x[6], 6);
295  HH(bb, cc, dd, ee, aa, x[13], 5);
296  HH(aa, bb, cc, dd, ee, x[11], 12);
297  HH(ee, aa, bb, cc, dd, x[5], 7);
298  HH(dd, ee, aa, bb, cc, x[12], 5);
299 
300  //Round 4
301  II(cc, dd, ee, aa, bb, x[1], 11);
302  II(bb, cc, dd, ee, aa, x[9], 12);
303  II(aa, bb, cc, dd, ee, x[11], 14);
304  II(ee, aa, bb, cc, dd, x[10], 15);
305  II(dd, ee, aa, bb, cc, x[0], 14);
306  II(cc, dd, ee, aa, bb, x[8], 15);
307  II(bb, cc, dd, ee, aa, x[12], 9);
308  II(aa, bb, cc, dd, ee, x[4], 8);
309  II(ee, aa, bb, cc, dd, x[13], 9);
310  II(dd, ee, aa, bb, cc, x[3], 14);
311  II(cc, dd, ee, aa, bb, x[7], 5);
312  II(bb, cc, dd, ee, aa, x[15], 6);
313  II(aa, bb, cc, dd, ee, x[14], 8);
314  II(ee, aa, bb, cc, dd, x[5], 6);
315  II(dd, ee, aa, bb, cc, x[6], 5);
316  II(cc, dd, ee, aa, bb, x[2], 12);
317 
318  //Round 5
319  JJ(bb, cc, dd, ee, aa, x[4], 9);
320  JJ(aa, bb, cc, dd, ee, x[0], 15);
321  JJ(ee, aa, bb, cc, dd, x[5], 5);
322  JJ(dd, ee, aa, bb, cc, x[9], 11);
323  JJ(cc, dd, ee, aa, bb, x[7], 6);
324  JJ(bb, cc, dd, ee, aa, x[12], 8);
325  JJ(aa, bb, cc, dd, ee, x[2], 13);
326  JJ(ee, aa, bb, cc, dd, x[10], 12);
327  JJ(dd, ee, aa, bb, cc, x[14], 5);
328  JJ(cc, dd, ee, aa, bb, x[1], 12);
329  JJ(bb, cc, dd, ee, aa, x[3], 13);
330  JJ(aa, bb, cc, dd, ee, x[8], 14);
331  JJ(ee, aa, bb, cc, dd, x[11], 11);
332  JJ(dd, ee, aa, bb, cc, x[6], 8);
333  JJ(cc, dd, ee, aa, bb, x[15], 5);
334  JJ(bb, cc, dd, ee, aa, x[13], 6);
335 
336  //Parallel round 1
337  JJJ(aaa, bbb, ccc, ddd, eee, x[5], 8);
338  JJJ(eee, aaa, bbb, ccc, ddd, x[14], 9);
339  JJJ(ddd, eee, aaa, bbb, ccc, x[7], 9);
340  JJJ(ccc, ddd, eee, aaa, bbb, x[0], 11);
341  JJJ(bbb, ccc, ddd, eee, aaa, x[9], 13);
342  JJJ(aaa, bbb, ccc, ddd, eee, x[2], 15);
343  JJJ(eee, aaa, bbb, ccc, ddd, x[11], 15);
344  JJJ(ddd, eee, aaa, bbb, ccc, x[4], 5);
345  JJJ(ccc, ddd, eee, aaa, bbb, x[13], 7);
346  JJJ(bbb, ccc, ddd, eee, aaa, x[6], 7);
347  JJJ(aaa, bbb, ccc, ddd, eee, x[15], 8);
348  JJJ(eee, aaa, bbb, ccc, ddd, x[8], 11);
349  JJJ(ddd, eee, aaa, bbb, ccc, x[1], 14);
350  JJJ(ccc, ddd, eee, aaa, bbb, x[10], 14);
351  JJJ(bbb, ccc, ddd, eee, aaa, x[3], 12);
352  JJJ(aaa, bbb, ccc, ddd, eee, x[12], 6);
353 
354  //Parallel round 2
355  III(eee, aaa, bbb, ccc, ddd, x[6], 9);
356  III(ddd, eee, aaa, bbb, ccc, x[11], 13);
357  III(ccc, ddd, eee, aaa, bbb, x[3], 15);
358  III(bbb, ccc, ddd, eee, aaa, x[7], 7);
359  III(aaa, bbb, ccc, ddd, eee, x[0], 12);
360  III(eee, aaa, bbb, ccc, ddd, x[13], 8);
361  III(ddd, eee, aaa, bbb, ccc, x[5], 9);
362  III(ccc, ddd, eee, aaa, bbb, x[10], 11);
363  III(bbb, ccc, ddd, eee, aaa, x[14], 7);
364  III(aaa, bbb, ccc, ddd, eee, x[15], 7);
365  III(eee, aaa, bbb, ccc, ddd, x[8], 12);
366  III(ddd, eee, aaa, bbb, ccc, x[12], 7);
367  III(ccc, ddd, eee, aaa, bbb, x[4], 6);
368  III(bbb, ccc, ddd, eee, aaa, x[9], 15);
369  III(aaa, bbb, ccc, ddd, eee, x[1], 13);
370  III(eee, aaa, bbb, ccc, ddd, x[2], 11);
371 
372  //Parallel round 3
373  HHH(ddd, eee, aaa, bbb, ccc, x[15], 9);
374  HHH(ccc, ddd, eee, aaa, bbb, x[5], 7);
375  HHH(bbb, ccc, ddd, eee, aaa, x[1], 15);
376  HHH(aaa, bbb, ccc, ddd, eee, x[3], 11);
377  HHH(eee, aaa, bbb, ccc, ddd, x[7], 8);
378  HHH(ddd, eee, aaa, bbb, ccc, x[14], 6);
379  HHH(ccc, ddd, eee, aaa, bbb, x[6], 6);
380  HHH(bbb, ccc, ddd, eee, aaa, x[9], 14);
381  HHH(aaa, bbb, ccc, ddd, eee, x[11], 12);
382  HHH(eee, aaa, bbb, ccc, ddd, x[8], 13);
383  HHH(ddd, eee, aaa, bbb, ccc, x[12], 5);
384  HHH(ccc, ddd, eee, aaa, bbb, x[2], 14);
385  HHH(bbb, ccc, ddd, eee, aaa, x[10], 13);
386  HHH(aaa, bbb, ccc, ddd, eee, x[0], 13);
387  HHH(eee, aaa, bbb, ccc, ddd, x[4], 7);
388  HHH(ddd, eee, aaa, bbb, ccc, x[13], 5);
389 
390  //Parallel round 4
391  GGG(ccc, ddd, eee, aaa, bbb, x[8], 15);
392  GGG(bbb, ccc, ddd, eee, aaa, x[6], 5);
393  GGG(aaa, bbb, ccc, ddd, eee, x[4], 8);
394  GGG(eee, aaa, bbb, ccc, ddd, x[1], 11);
395  GGG(ddd, eee, aaa, bbb, ccc, x[3], 14);
396  GGG(ccc, ddd, eee, aaa, bbb, x[11], 14);
397  GGG(bbb, ccc, ddd, eee, aaa, x[15], 6);
398  GGG(aaa, bbb, ccc, ddd, eee, x[0], 14);
399  GGG(eee, aaa, bbb, ccc, ddd, x[5], 6);
400  GGG(ddd, eee, aaa, bbb, ccc, x[12], 9);
401  GGG(ccc, ddd, eee, aaa, bbb, x[2], 12);
402  GGG(bbb, ccc, ddd, eee, aaa, x[13], 9);
403  GGG(aaa, bbb, ccc, ddd, eee, x[9], 12);
404  GGG(eee, aaa, bbb, ccc, ddd, x[7], 5);
405  GGG(ddd, eee, aaa, bbb, ccc, x[10], 15);
406  GGG(ccc, ddd, eee, aaa, bbb, x[14], 8);
407 
408  //Parallel round 5
409  FFF(bbb, ccc, ddd, eee, aaa, x[12], 8);
410  FFF(aaa, bbb, ccc, ddd, eee, x[15], 5);
411  FFF(eee, aaa, bbb, ccc, ddd, x[10], 12);
412  FFF(ddd, eee, aaa, bbb, ccc, x[4], 9);
413  FFF(ccc, ddd, eee, aaa, bbb, x[1], 12);
414  FFF(bbb, ccc, ddd, eee, aaa, x[5], 5);
415  FFF(aaa, bbb, ccc, ddd, eee, x[8], 14);
416  FFF(eee, aaa, bbb, ccc, ddd, x[7], 6);
417  FFF(ddd, eee, aaa, bbb, ccc, x[6], 8);
418  FFF(ccc, ddd, eee, aaa, bbb, x[2], 13);
419  FFF(bbb, ccc, ddd, eee, aaa, x[13], 6);
420  FFF(aaa, bbb, ccc, ddd, eee, x[14], 5);
421  FFF(eee, aaa, bbb, ccc, ddd, x[0], 15);
422  FFF(ddd, eee, aaa, bbb, ccc, x[3], 13);
423  FFF(ccc, ddd, eee, aaa, bbb, x[9], 11);
424  FFF(bbb, ccc, ddd, eee, aaa, x[11], 11);
425 
426  //Combine results
427  ddd = context->h[1] + cc + ddd;
428  context->h[1] = context->h[2] + dd + eee;
429  context->h[2] = context->h[3] + ee + aaa;
430  context->h[3] = context->h[4] + aa + bbb;
431  context->h[4] = context->h[0] + bb + ccc;
432  context->h[0] = ddd;
433 }
434 
435 #endif
void ripemd160Init(Ripemd160Context *context)
Initialize RIPEMD-160 message digest context.
Definition: ripemd160.c:121
#define FFF(a, b, c, d, e, x, s)
Definition: ripemd160.c:52
#define cryptoMemcpy(dest, src, length)
Definition: crypto.h:590
#define cryptoFreeMem(p)
Definition: crypto.h:578
error_t(* HashAlgoCompute)(const void *data, size_t length, uint8_t *digest)
Definition: crypto.h:1020
#define cryptoAllocMem(size)
Definition: crypto.h:573
General definitions for cryptographic algorithms.
#define GGG(a, b, c, d, e, x, s)
Definition: ripemd160.c:53
const HashAlgo ripemd160HashAlgo
Definition: ripemd160.c:71
uint32_t totalSize
#define HH(a, b, c, d, e, x, s)
Definition: ripemd160.c:48
uint32_t x[16]
Definition: ripemd160.h:63
RIPEMD-160 hash function.
const uint8_t ripemd160Oid[5]
Definition: ripemd160.c:68
void(* HashAlgoInit)(void *context)
Definition: crypto.h:1021
uint64_t totalSize
Definition: ripemd160.h:67
#define JJJ(a, b, c, d, e, x, s)
Definition: ripemd160.c:56
#define htole32(value)
Definition: cpu_endian.h:404
void ripemd160Update(Ripemd160Context *context, const void *data, size_t length)
Update the RIPEMD-160 context with a portion of the message being hashed.
Definition: ripemd160.c:144
uint32_t h[5]
Definition: ripemd160.h:58
RIPEMD-160 algorithm context.
Definition: ripemd160.h:54
#define MIN(a, b)
Definition: os_port.h:60
void(* HashAlgoUpdate)(void *context, const void *data, size_t length)
Definition: crypto.h:1022
Success.
Definition: error.h:42
#define III(a, b, c, d, e, x, s)
Definition: ripemd160.c:55
error_t
Error codes.
Definition: error.h:40
void ripemd160Final(Ripemd160Context *context, uint8_t *digest)
Finish the RIPEMD-160 message digest.
Definition: ripemd160.c:183
unsigned int uint_t
Definition: compiler_port.h:43
void ripemd160ProcessBlock(Ripemd160Context *context)
Process message in 16-word blocks.
Definition: ripemd160.c:223
error_t ripemd160Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using RIPEMD-160.
Definition: ripemd160.c:94
uint8_t data[]
Definition: dtls_misc.h:167
#define II(a, b, c, d, e, x, s)
Definition: ripemd160.c:49
uint16_t aa
Definition: dns_common.h:169
#define GG(a, b, c, d, e, x, s)
Definition: ripemd160.c:47
#define RIPEMD160_BLOCK_SIZE
Definition: ripemd160.h:36
#define RIPEMD160_DIGEST_SIZE
Definition: ripemd160.h:38
#define FF(a, b, c, d, e, x, s)
Definition: ripemd160.c:46
#define letoh32(value)
Definition: cpu_endian.h:412
#define HHH(a, b, c, d, e, x, s)
Definition: ripemd160.c:54
Common interface for hash algorithms.
Definition: crypto.h:1054
uint8_t length
Definition: dtls_misc.h:140
uint8_t n
uint8_t buffer[64]
Definition: ripemd160.h:64
uint8_t digest[20]
Definition: ripemd160.h:59
#define JJ(a, b, c, d, e, x, s)
Definition: ripemd160.c:50
void(* HashAlgoFinal)(void *context, uint8_t *digest)
Definition: crypto.h:1023