Loading...
Searching...
No Matches
sha3.h
Go to the documentation of this file.
1/*-
2 * Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
3 * Joan Daemen, Michaƫl Peeters, Gilles Van Assche and Ronny Van Keer, hereby
4 * denoted as "the implementer".
5 *
6 * RIOT-OS adaptation by Mathias Tausig
7 *
8 * This software is released under the Creative Commons CC0 1.0 license.
9 * To the extent possible under law, the implementer has waived all copyright
10 * and related or neighboring rights to the source code in this file.
11 * For more information see: http://creativecommons.org/publicdomain/zero/1.0/
12 */
13
27#ifndef HASHES_SHA3_H
28#define HASHES_SHA3_H
29
30#include <stdlib.h>
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
39#define SHA3_256_DIGEST_LENGTH 32
40
44#define SHA3_384_DIGEST_LENGTH 48
45
49#define SHA3_512_DIGEST_LENGTH 64
50
54typedef struct {
56 unsigned char state[200];
58 unsigned int i;
60 unsigned char delimitedSuffix;
62 unsigned int rate;
64 unsigned int capacity;
66 unsigned int rateInBytes;
68
77void Keccak_init(keccak_state_t *ctx, unsigned int rate, unsigned int capacity,
78 unsigned char delimitedSuffix);
79
87void Keccak_update(keccak_state_t *ctx, const unsigned char *input,
88 unsigned long long int inputByteLen);
89
97void Keccak_final(keccak_state_t *ctx, unsigned char *output,
98 unsigned long long int outputByteLen);
99
106
114void sha3_update(keccak_state_t *ctx, const void *data, size_t len);
115
122void sha3_256_final(keccak_state_t *ctx, void *digest);
123
130
137void sha3_384_final(keccak_state_t *ctx, void *digest);
138
145
153void sha3_512_final(keccak_state_t *ctx, void *digest);
154
164void sha3_256(void *digest, const void *data, size_t len);
165
175void sha3_384(void *digest, const void *data, size_t len);
176
186void sha3_512(void *digest, const void *data, size_t len);
187
188#ifdef __cplusplus
189}
190#endif
191
192#endif /* HASHES_SHA3_H */
void sha3_384_final(keccak_state_t *ctx, void *digest)
SHA3-384 finalization.
void sha3_256_init(keccak_state_t *ctx)
SHA3-256 initialization.
void Keccak_update(keccak_state_t *ctx, const unsigned char *input, unsigned long long int inputByteLen)
Absorbs data into a sponge.
void Keccak_final(keccak_state_t *ctx, unsigned char *output, unsigned long long int outputByteLen)
Squeeze data from a sponge.
void Keccak_init(keccak_state_t *ctx, unsigned int rate, unsigned int capacity, unsigned char delimitedSuffix)
Initialise a sponge based on a keccak-1600 permutation.
void sha3_384_init(keccak_state_t *ctx)
SHA3-384 initialization.
void sha3_384(void *digest, const void *data, size_t len)
A wrapper function to simplify the generation of a hash, this is useful for generating SHA3-384 from ...
void sha3_512(void *digest, const void *data, size_t len)
A wrapper function to simplify the generation of a hash, this is useful for generating SHA3-512 from ...
void sha3_512_final(keccak_state_t *ctx, void *digest)
SHA3-512 finalization.
void sha3_256(void *digest, const void *data, size_t len)
A wrapper function to simplify the generation of a hash, this is useful for generating SHA3-256 from ...
void sha3_update(keccak_state_t *ctx, const void *data, size_t len)
Add bytes into the hash.
void sha3_512_init(keccak_state_t *ctx)
SHA3-512 initialization.
void sha3_256_final(keccak_state_t *ctx, void *digest)
SHA3-256 finalization.
Context for operations on a sponge with keccak permutation.
Definition sha3.h:54
unsigned int rate
The bitrate of the sponge.
Definition sha3.h:62
unsigned int rateInBytes
The rate in bytes of the sponge.
Definition sha3.h:66
unsigned int capacity
The capacity in bits of the sponge.
Definition sha3.h:64
unsigned char delimitedSuffix
The suffix used for padding.
Definition sha3.h:60
unsigned int i
Current position within the state.
Definition sha3.h:58