php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
KeccakSponge.h
Go to the documentation of this file.
1/*
2Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
3Joan Daemen, Michaƫl Peeters, Gilles Van Assche and Ronny Van Keer, hereby
4denoted as "the implementer".
5
6For more information, feedback or questions, please refer to our websites:
7http://keccak.noekeon.org/
8http://keyak.noekeon.org/
9http://ketje.noekeon.org/
10
11To the extent possible under law, the implementer has waived all copyright
12and related or neighboring rights to the source code in this file.
13http://creativecommons.org/publicdomain/zero/1.0/
14*/
15
16#ifndef _KeccakSponge_h_
17#define _KeccakSponge_h_
18
41
42#ifdef DontReallyInclude_DocumentationOnly
67int Prefix_Sponge(unsigned int rate, unsigned int capacity, const unsigned char *input, size_t inputByteLen, unsigned char suffix, unsigned char *output, size_t outputByteLen);
68
79int Prefix_SpongeInitialize(Prefix_SpongeInstance *spongeInstance, unsigned int rate, unsigned int capacity);
80
91int Prefix_SpongeAbsorb(Prefix_SpongeInstance *spongeInstance, const unsigned char *data, size_t dataByteLen);
92
115int Prefix_SpongeAbsorbLastFewBits(Prefix_SpongeInstance *spongeInstance, unsigned char delimitedData);
116
127int Prefix_SpongeSqueeze(Prefix_SpongeInstance *spongeInstance, unsigned char *data, size_t dataByteLen);
128#endif
129
130#include <string.h>
131#include "align.h"
132
133#define KCP_DeclareSpongeStructure(prefix, size, alignment) \
134 ALIGN(alignment) typedef struct prefix##_SpongeInstanceStruct { \
135 unsigned char state[size]; \
136 unsigned int rate; \
137 unsigned int byteIOIndex; \
138 int squeezing; \
139 } prefix##_SpongeInstance;
140
141#define KCP_DeclareSpongeFunctions(prefix) \
142 int prefix##_Sponge(unsigned int rate, unsigned int capacity, const unsigned char *input, size_t inputByteLen, unsigned char suffix, unsigned char *output, size_t outputByteLen); \
143 int prefix##_SpongeInitialize(prefix##_SpongeInstance *spongeInstance, unsigned int rate, unsigned int capacity); \
144 int prefix##_SpongeAbsorb(prefix##_SpongeInstance *spongeInstance, const unsigned char *data, size_t dataByteLen); \
145 int prefix##_SpongeAbsorbLastFewBits(prefix##_SpongeInstance *spongeInstance, unsigned char delimitedData); \
146 int prefix##_SpongeSqueeze(prefix##_SpongeInstance *spongeInstance, unsigned char *data, size_t dataByteLen);
147
148#ifndef KeccakP200_excluded
149 #include "KeccakP-200-SnP.h"
150 KCP_DeclareSpongeStructure(KeccakWidth200, KeccakP200_stateSizeInBytes, KeccakP200_stateAlignment)
151 KCP_DeclareSpongeFunctions(KeccakWidth200)
152#endif
153
154#ifndef KeccakP400_excluded
155 #include "KeccakP-400-SnP.h"
156 KCP_DeclareSpongeStructure(KeccakWidth400, KeccakP400_stateSizeInBytes, KeccakP400_stateAlignment)
158#endif
159
160#ifndef KeccakP800_excluded
161 #include "KeccakP-800-SnP.h"
162 KCP_DeclareSpongeStructure(KeccakWidth800, KeccakP800_stateSizeInBytes, KeccakP800_stateAlignment)
164#endif
165
166#ifndef KeccakP1600_excluded
167 #include "KeccakP-1600-SnP.h"
170#endif
171
172#ifndef KeccakP1600_excluded
173 #include "KeccakP-1600-SnP.h"
175 KCP_DeclareSpongeFunctions(KeccakWidth1600_12rounds)
176#endif
177
178#endif
#define KeccakP1600_stateSizeInBytes
#define KeccakP1600_stateAlignment
KeccakP400_stateAlignment KeccakP800_stateSizeInBytes
#define KCP_DeclareSpongeFunctions(prefix)
#define KCP_DeclareSpongeStructure(prefix, size, alignment)
KeccakP400_stateSizeInBytes
zend_constant * data