forked from XKCP/XKCP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimpleFIPS202.h
68 lines (57 loc) · 2.88 KB
/
SimpleFIPS202.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
Implementation by Gilles Van Assche, hereby denoted as "the implementer".
For more information, feedback or questions, please refer to our website:
https://keccak.team/
To the extent possible under law, the implementer has waived all copyright
and related or neighboring rights to the source code in this file.
http://creativecommons.org/publicdomain/zero/1.0/
*/
#ifndef _SimpleFIPS202_h_
#define _SimpleFIPS202_h_
#include "KeccakSpongeWidth1600.h"
#include <string.h>
/** Implementation of the SHAKE128 extendable output function (XOF) [FIPS 202].
* @param output Pointer to the output buffer.
* @param outputByteLen The desired number of output bytes.
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHAKE128(unsigned char *output, size_t outputByteLen, const unsigned char *input, size_t inputByteLen);
/** Implementation of the SHAKE256 extendable output function (XOF) [FIPS 202].
* @param output Pointer to the output buffer.
* @param outputByteLen The desired number of output bytes.
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHAKE256(unsigned char *output, size_t outputByteLen, const unsigned char *input, size_t inputByteLen);
/** Implementation of SHA3-224 [FIPS 202].
* @param output Pointer to the output buffer (28 bytes).
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHA3_224(unsigned char *output, const unsigned char *input, size_t inputByteLen);
/** Implementation of SHA3-256 [FIPS 202].
* @param output Pointer to the output buffer (32 bytes).
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHA3_256(unsigned char *output, const unsigned char *input, size_t inputByteLen);
/** Implementation of SHA3-384 [FIPS 202].
* @param output Pointer to the output buffer (48 bytes).
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHA3_384(unsigned char *output, const unsigned char *input, size_t inputByteLen);
/** Implementation of SHA3-512 [FIPS 202].
* @param output Pointer to the output buffer (64 bytes).
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHA3_512(unsigned char *output, const unsigned char *input, size_t inputByteLen);
#endif