sha224.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2005 Colin Percival
3  * SPDX-FileCopyrightText: 2013 Christian Mehlis & RenĂ© Kijewski
4  * SPDX-FileCopyrightText: 2016 Martin Landsmann <martin.landsmann@haw-hamburg.de>
5  * SPDX-FileCopyrightText: 2016 OTA keys S.A.
6  * SPDX-FileCopyrightText: 2020 HAW Hamburg
7  * SPDX-License-Identifier: BSD-2-Clause
8  */
9 
10 #pragma once
11 
28 #include <inttypes.h>
29 #include <stddef.h>
30 
31 #include "hashes/sha2xx_common.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
40 #define SHA224_DIGEST_LENGTH (28)
41 
45 #define SHA224_INTERNAL_BLOCK_SIZE (64)
46 
51 
58 
66 static inline void sha224_update(sha224_context_t *ctx, const void *data, size_t len)
67 {
68  sha2xx_update(ctx, data, len);
69 }
70 
78 static inline void sha224_final(sha224_context_t *ctx, void *digest)
79 {
80  sha2xx_final(ctx, digest, SHA224_DIGEST_LENGTH);
81 }
82 
92 void sha224(const void *data, size_t len, void *digest);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
sha2xx_context_t sha224_context_t
Context for cipher operations based on sha224.
Definition: sha224.h:50
void sha224_init(sha224_context_t *ctx)
SHA-224 initialization.
static void sha224_update(sha224_context_t *ctx, const void *data, size_t len)
Add bytes into the hash.
Definition: sha224.h:66
static void sha224_final(sha224_context_t *ctx, void *digest)
SHA-224 finalization.
Definition: sha224.h:78
#define SHA224_DIGEST_LENGTH
Length of SHA224 digests in bytes.
Definition: sha224.h:40
void sha224(const void *data, size_t len, void *digest)
A wrapper function to simplify the generation of a hash, this is useful for generating sha224 for one...
void sha2xx_final(sha2xx_context_t *ctx, void *digest, size_t dig_len)
SHA-2XX finalization.
void sha2xx_update(sha2xx_context_t *ctx, const void *data, size_t len)
Add bytes into the hash.
Adds include for missing inttype definitions.
Common definitions for the SHA-224/256 hash functions.
Structure to hold the SHA-2XX context.
Definition: sha2xx_common.h:38