ripemd160.h
Go to the documentation of this file.
1 /**
2  * @file ripemd160.h
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-2025 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 2.5.0
29  **/
30 
31 #ifndef _RIPEMD160_H
32 #define _RIPEMD160_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //RIPEMD-160 block size
38 #define RIPEMD160_BLOCK_SIZE 64
39 //RIPEMD-160 digest size
40 #define RIPEMD160_DIGEST_SIZE 20
41 //Minimum length of the padding string
42 #define RIPEMD160_MIN_PAD_SIZE 9
43 //Common interface for hash algorithms
44 #define RIPEMD160_HASH_ALGO (&ripemd160HashAlgo)
45 
46 //C++ guard
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 
52 /**
53  * @brief RIPEMD-160 algorithm context
54  **/
55 
56 typedef struct
57 {
58  uint32_t h[5];
59  union
60  {
61  uint32_t x[16];
62  uint8_t buffer[64];
63  };
64  size_t size;
65  uint64_t totalSize;
67 
68 
69 //RIPEMD-160 related constants
70 extern const uint8_t RIPEMD160_OID[5];
71 extern const HashAlgo ripemd160HashAlgo;
72 
73 //RIPEMD-160 related functions
74 error_t ripemd160Compute(const void *data, size_t length, uint8_t *digest);
75 void ripemd160Init(Ripemd160Context *context);
76 void ripemd160Update(Ripemd160Context *context, const void *data, size_t length);
77 void ripemd160Final(Ripemd160Context *context, uint8_t *digest);
79 
80 //C++ guard
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif
void ripemd160ProcessBlock(Ripemd160Context *context)
Process message in 16-word blocks.
Definition: ripemd160.c:251
uint64_t totalSize
Definition: ripemd160.h:65
uint8_t x
Definition: lldp_ext_med.h:211
uint8_t data[]
Definition: ethernet.h:222
const HashAlgo ripemd160HashAlgo
Definition: ripemd160.c:73
void ripemd160Final(Ripemd160Context *context, uint8_t *digest)
Finish the RIPEMD-160 message digest.
Definition: ripemd160.c:206
uint8_t h
Definition: ndp.h:302
error_t
Error codes.
Definition: error.h:43
void ripemd160Init(Ripemd160Context *context)
Initialize RIPEMD-160 message digest context.
Definition: ripemd160.c:144
const uint8_t RIPEMD160_OID[5]
Definition: ripemd160.c:70
General definitions for cryptographic algorithms.
RIPEMD-160 algorithm context.
Definition: ripemd160.h:57
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:167
error_t ripemd160Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using RIPEMD-160.
Definition: ripemd160.c:99
uint8_t length
Definition: tcp.h:375
Common interface for hash algorithms.
Definition: crypto.h:1082