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