digest-kangarootwelve 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,93 @@
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
+ For more information, feedback or questions, please refer to our websites:
7
+ http://keccak.noekeon.org/
8
+ http://keyak.noekeon.org/
9
+ http://ketje.noekeon.org/
10
+
11
+ To the extent possible under law, the implementer has waived all copyright
12
+ and related or neighboring rights to the source code in this file.
13
+ http://creativecommons.org/publicdomain/zero/1.0/
14
+ */
15
+
16
+ #ifndef _KangarooTwelve_h_
17
+ #define _KangarooTwelve_h_
18
+
19
+ #ifndef KeccakP1600_excluded
20
+
21
+ #include <stddef.h>
22
+ #include "align.h"
23
+ #include "KeccakSpongeWidth1600.h"
24
+ #include "Phases.h"
25
+
26
+ typedef KCP_Phases KangarooTwelve_Phases;
27
+
28
+ typedef struct {
29
+ KeccakWidth1600_12rounds_SpongeInstance queueNode;
30
+ KeccakWidth1600_12rounds_SpongeInstance finalNode;
31
+ size_t fixedOutputLength;
32
+ size_t blockNumber;
33
+ unsigned int queueAbsorbedLen;
34
+ KangarooTwelve_Phases phase;
35
+ } KangarooTwelve_Instance;
36
+
37
+ /** Extendable ouput function KangarooTwelve.
38
+ * @param input Pointer to the input message (M).
39
+ * @param inputByteLen The length of the input message in bytes.
40
+ * @param output Pointer to the output buffer.
41
+ * @param outputByteLen The desired number of output bytes.
42
+ * @param customization Pointer to the customization string (C).
43
+ * @param customByteLen The length of the customization string in bytes.
44
+ * @return 0 if successful, 1 otherwise.
45
+ */
46
+ int KangarooTwelve(const unsigned char *input, size_t inputByteLen, unsigned char *output, size_t outputByteLen, const unsigned char *customization, size_t customByteLen );
47
+
48
+ /**
49
+ * Function to initialize a KangarooTwelve instance.
50
+ * @param ktInstance Pointer to the instance to be initialized.
51
+ * @param outputByteLen The desired number of output bytes,
52
+ * or 0 for an arbitrarily-long output.
53
+ * @return 0 if successful, 1 otherwise.
54
+ */
55
+ int KangarooTwelve_Initialize(KangarooTwelve_Instance *ktInstance, size_t outputByteLen);
56
+
57
+ /**
58
+ * Function to give input data to be absorbed.
59
+ * @param ktInstance Pointer to the instance initialized by KangarooTwelve_Initialize().
60
+ * @param input Pointer to the input message data (M).
61
+ * @param inputByteLen The number of bytes provided in the input message data.
62
+ * @return 0 if successful, 1 otherwise.
63
+ */
64
+ int KangarooTwelve_Update(KangarooTwelve_Instance *ktInstance, const unsigned char *input, size_t inputByteLen);
65
+
66
+ /**
67
+ * Function to call after all the input message has been input, and to get
68
+ * output bytes if the length was specified when calling KangarooTwelve_Initialize().
69
+ * @param ktInstance Pointer to the hash instance initialized by KangarooTwelve_Initialize().
70
+ * If @a outputByteLen was not 0 in the call to KangarooTwelve_Initialize(), the number of
71
+ * output bytes is equal to @a outputByteLen.
72
+ * If @a outputByteLen was 0 in the call to KangarooTwelve_Initialize(), the output bytes
73
+ * must be extracted using the KangarooTwelve_Squeeze() function.
74
+ * @param output Pointer to the buffer where to store the output data.
75
+ * @param customization Pointer to the customization string (C).
76
+ * @param customByteLen The length of the customization string in bytes.
77
+ * @return 0 if successful, 1 otherwise.
78
+ */
79
+ int KangarooTwelve_Final(KangarooTwelve_Instance *ktInstance, unsigned char *output, const unsigned char *customization, size_t customByteLen);
80
+
81
+ /**
82
+ * Function to squeeze output data.
83
+ * @param ktInstance Pointer to the hash instance initialized by KangarooTwelve_Initialize().
84
+ * @param data Pointer to the buffer where to store the output data.
85
+ * @param outputByteLen The number of output bytes desired.
86
+ * @pre KangarooTwelve_Final() must have been already called.
87
+ * @return 0 if successful, 1 otherwise.
88
+ */
89
+ int KangarooTwelve_Squeeze(KangarooTwelve_Instance *ktInstance, unsigned char *output, size_t outputByteLen);
90
+
91
+ #endif
92
+
93
+ #endif
@@ -0,0 +1,38 @@
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
+ For more information, feedback or questions, please refer to our websites:
7
+ http://keccak.noekeon.org/
8
+ http://keyak.noekeon.org/
9
+ http://ketje.noekeon.org/
10
+
11
+ To the extent possible under law, the implementer has waived all copyright
12
+ and related or neighboring rights to the source code in this file.
13
+ http://creativecommons.org/publicdomain/zero/1.0/
14
+ */
15
+
16
+ #ifndef _KeccakP_1600_SnP_h_
17
+ #define _KeccakP_1600_SnP_h_
18
+
19
+ /** For the documentation, see SnP-documentation.h.
20
+ */
21
+
22
+ #define KeccakP1600_implementation "64-bit compact implementation"
23
+ #define KeccakP1600_stateSizeInBytes 200
24
+ #define KeccakP1600_stateAlignment 8
25
+
26
+ #define KeccakP1600_StaticInitialize()
27
+ void KeccakP1600_Initialize(void *state);
28
+ void KeccakP1600_AddByte(void *state, unsigned char data, unsigned int offset);
29
+ void KeccakP1600_AddBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length);
30
+ void KeccakP1600_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length);
31
+ void KeccakP1600_OverwriteWithZeroes(void *state, unsigned int byteCount);
32
+ void KeccakP1600_Permute_Nrounds(void *state, unsigned int nrounds);
33
+ void KeccakP1600_Permute_12rounds(void *state);
34
+ void KeccakP1600_Permute_24rounds(void *state);
35
+ void KeccakP1600_ExtractBytes(const void *state, unsigned char *data, unsigned int offset, unsigned int length);
36
+ void KeccakP1600_ExtractAndAddBytes(const void *state, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length);
37
+
38
+ #endif
@@ -0,0 +1,412 @@
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
+ For more information, feedback or questions, please refer to our websites:
7
+ http://keccak.noekeon.org/
8
+ http://keyak.noekeon.org/
9
+ http://ketje.noekeon.org/
10
+
11
+ To the extent possible under law, the implementer has waived all copyright
12
+ and related or neighboring rights to the source code in this file.
13
+ http://creativecommons.org/publicdomain/zero/1.0/
14
+ */
15
+
16
+ #include <string.h>
17
+ #include <stdlib.h>
18
+ #include "brg_endian.h"
19
+ #include "KeccakP-1600-SnP.h"
20
+ #include "SnP-Relaned.h"
21
+
22
+ #define USE_MEMSET
23
+ /* #define DIVISION_INSTRUCTION */ /* comment if no division instruction or more compact when not using division */
24
+ #define UNROLL_CHILOOP /* comment more compact using for loop */
25
+
26
+ typedef unsigned char UINT8;
27
+ typedef unsigned long long int UINT64;
28
+ typedef unsigned int tSmallUInt; /*INFO It could be more optimized to use "unsigned char" on an 8-bit CPU */
29
+ typedef UINT64 tKeccakLane;
30
+
31
+ #if defined(_MSC_VER)
32
+ #define ROL64(a, offset) _rotl64(a, offset)
33
+ #elif defined(UseSHLD)
34
+ #define ROL64(x,N) ({ \
35
+ register UINT64 __out; \
36
+ register UINT64 __in = x; \
37
+ __asm__ ("shld %2,%0,%0" : "=r"(__out) : "0"(__in), "i"(N)); \
38
+ __out; \
39
+ })
40
+ #else
41
+ #define ROL64(a, offset) ((((UINT64)a) << offset) ^ (((UINT64)a) >> (64-offset)))
42
+ #endif
43
+
44
+ #define cKeccakNumberOfRounds 24
45
+
46
+ const UINT8 KeccakP1600_RotationConstants[25] =
47
+ {
48
+ 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44
49
+ };
50
+
51
+ const UINT8 KeccakP1600_PiLane[25] =
52
+ {
53
+ 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1
54
+ };
55
+
56
+ #if defined(DIVISION_INSTRUCTION)
57
+ #define MOD5(argValue) ((argValue) % 5)
58
+ #else
59
+ const UINT8 KeccakP1600_Mod5[10] =
60
+ {
61
+ 0, 1, 2, 3, 4, 0, 1, 2, 3, 4
62
+ };
63
+ #define MOD5(argValue) KeccakP1600_Mod5[argValue]
64
+ #endif
65
+
66
+ /* ---------------------------------------------------------------- */
67
+
68
+ static tKeccakLane KeccakF1600_GetNextRoundConstant( UINT8 *LFSR );
69
+ static tKeccakLane KeccakF1600_GetNextRoundConstant( UINT8 *LFSR )
70
+ {
71
+ tSmallUInt i;
72
+ tKeccakLane roundConstant;
73
+ tSmallUInt doXOR;
74
+ tSmallUInt tempLSFR;
75
+
76
+ roundConstant = 0;
77
+ tempLSFR = *LFSR;
78
+ for(i=1; i<128; i <<= 1)
79
+ {
80
+ doXOR = tempLSFR & 1;
81
+ if ((tempLSFR & 0x80) != 0)
82
+ /* Primitive polynomial over GF(2): x^8+x^6+x^5+x^4+1 */
83
+ tempLSFR = (tempLSFR << 1) ^ 0x71;
84
+ else
85
+ tempLSFR <<= 1;
86
+
87
+ if ( doXOR != 0 )
88
+ roundConstant ^= (tKeccakLane)1ULL << (i - 1);
89
+ }
90
+ *LFSR = (UINT8)tempLSFR;
91
+ return ( roundConstant );
92
+ }
93
+
94
+ /* ---------------------------------------------------------------- */
95
+
96
+ void KeccakP1600_Initialize(void *argState)
97
+ {
98
+ #if defined(USE_MEMSET)
99
+ memset( argState, 0, 25 * 8 );
100
+ #else
101
+ tSmallUInt i;
102
+ tKeccakLane *state;
103
+
104
+ state = argState;
105
+ i = 25;
106
+ do
107
+ {
108
+ *(state++) = 0;
109
+ }
110
+ while ( --i != 0 );
111
+ #endif
112
+ }
113
+
114
+ /* ---------------------------------------------------------------- */
115
+
116
+ void KeccakP1600_AddBytesInLane(void *argState, unsigned int lanePosition, const unsigned char *data, unsigned int offset, unsigned int length)
117
+ {
118
+ unsigned int i;
119
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
120
+ unsigned char * state = (unsigned char*)argState + lanePosition * sizeof(tKeccakLane) + offset;
121
+ for(i=0; i<length; i++)
122
+ ((unsigned char *)state)[i] ^= data[i];
123
+ #else
124
+ tKeccakLane lane = 0;
125
+ for(i=0; i<length; i++)
126
+ lane |= ((tKeccakLane)data[i]) << ((i+offset)*8);
127
+ ((tKeccakLane*)argState)[lanePosition] ^= lane;
128
+ #endif
129
+ }
130
+
131
+ /* ---------------------------------------------------------------- */
132
+
133
+ void KeccakP1600_AddLanes(void *state, const unsigned char *data, unsigned int laneCount)
134
+ {
135
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
136
+ tSmallUInt i;
137
+ laneCount *= sizeof(tKeccakLane);
138
+ for( i = 0; i < laneCount; ++i) {
139
+ ((unsigned char*)state)[i] ^= data[i];
140
+ }
141
+ #else
142
+ tSmallUInt i;
143
+ const UINT8 *curData = data;
144
+ for(i=0; i<laneCount; i++, curData+=8) {
145
+ tKeccakLane lane = (tKeccakLane)curData[0]
146
+ | ((tKeccakLane)curData[1] << 8)
147
+ | ((tKeccakLane)curData[2] << 16)
148
+ | ((tKeccakLane)curData[3] << 24)
149
+ | ((tKeccakLane)curData[4] << 32)
150
+ | ((tKeccakLane)curData[5] << 40)
151
+ | ((tKeccakLane)curData[6] << 48)
152
+ | ((tKeccakLane)curData[7] << 56);
153
+ ((tKeccakLane*)state)[i] ^= lane;
154
+ }
155
+ #endif
156
+ }
157
+
158
+ /* ---------------------------------------------------------------- */
159
+
160
+ void KeccakP1600_AddByte(void *state, unsigned char byte, unsigned int offset)
161
+ {
162
+ UINT64 lane = byte;
163
+ lane <<= (offset%8)*8;
164
+ ((UINT64*)state)[offset/8] ^= lane;
165
+ }
166
+
167
+ /* ---------------------------------------------------------------- */
168
+
169
+ void KeccakP1600_AddBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
170
+ {
171
+ SnP_AddBytes(state, data, offset, length, KeccakP1600_AddLanes, KeccakP1600_AddBytesInLane, 8);
172
+ }
173
+
174
+ /* ---------------------------------------------------------------- */
175
+
176
+ void KeccakP1600_OverwriteBytesInLane(void *argState, unsigned int lanePosition, const unsigned char *data, unsigned int offset, unsigned int length)
177
+ {
178
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
179
+ memcpy((unsigned char*)argState+lanePosition*8+offset, data, length);
180
+ #else
181
+ unsigned int i;
182
+ tKeccakLane *state = (tKeccakLane*)argState;
183
+ tKeccakLane lane = state[lanePosition];
184
+ for(i=0; i<length; i++) {
185
+ lane &= ~(((tKeccakLane)0xFF) << ((i+offset)*8));
186
+ lane |= ((tKeccakLane)data[i]) << ((i+offset)*8);
187
+ }
188
+ state[lanePosition] = lane;
189
+ #endif
190
+ }
191
+
192
+ /* ---------------------------------------------------------------- */
193
+
194
+ void KeccakP1600_OverwriteLanes(void *state, const unsigned char *data, unsigned int laneCount)
195
+ {
196
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
197
+ memcpy((unsigned char*)state, data, laneCount*8);
198
+ #else
199
+ tSmallUInt i;
200
+ const UINT8 *curData = data;
201
+ for(i=0; i<laneCount; i++, curData+=8) {
202
+ tKeccakLane lane = (tKeccakLane)curData[0]
203
+ | ((tKeccakLane)curData[1] << 8)
204
+ | ((tKeccakLane)curData[2] << 16)
205
+ | ((tKeccakLane)curData[3] << 24)
206
+ | ((tKeccakLane)curData[4] << 32)
207
+ | ((tKeccakLane)curData[5] << 40)
208
+ | ((tKeccakLane)curData[6] << 48)
209
+ | ((tKeccakLane)curData[7] << 56);
210
+ ((tKeccakLane*)state)[i] = lane;
211
+ }
212
+ #endif
213
+ }
214
+
215
+ /* ---------------------------------------------------------------- */
216
+
217
+ void KeccakP1600_OverwriteBytes(void *state, const unsigned char *data, unsigned int offset, unsigned int length)
218
+ {
219
+ SnP_OverwriteBytes(state, data, offset, length, KeccakP1600_OverwriteLanes, KeccakP1600_OverwriteBytesInLane, 8);
220
+ }
221
+
222
+ /* ---------------------------------------------------------------- */
223
+
224
+ void KeccakP1600_OverwriteWithZeroes(void *argState, unsigned int byteCount)
225
+ {
226
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
227
+ memset((unsigned char*)argState, 0, byteCount);
228
+ #else
229
+ tKeccakLane *state = (tKeccakLane*)argState;
230
+ unsigned int i, j;
231
+ for(i=0; i<byteCount/8; i++)
232
+ state[i] = 0;
233
+ for(j=0; j<byteCount%8; j++)
234
+ state[i] &= ~(((tKeccakLane)0xFF) << (j*8));
235
+ #endif
236
+ }
237
+
238
+ /* ---------------------------------------------------------------- */
239
+
240
+ static void KeccakP1600_Permute_NroundsLFSR(void *argState, UINT8 rounds, UINT8 LFSRinitialState)
241
+ {
242
+ tSmallUInt x, y, round;
243
+ tKeccakLane temp;
244
+ tKeccakLane BC[5];
245
+ tKeccakLane *state;
246
+ UINT8 LFSRstate;
247
+
248
+ state = (tKeccakLane*)argState;
249
+ LFSRstate = LFSRinitialState;
250
+ round = rounds;
251
+ do
252
+ {
253
+ /* Theta */
254
+ for ( x = 0; x < 5; ++x )
255
+ {
256
+ BC[x] = state[x] ^ state[5 + x] ^ state[10 + x] ^ state[15 + x] ^ state[20 + x];
257
+ }
258
+ for ( x = 0; x < 5; ++x )
259
+ {
260
+ temp = BC[MOD5(x+4)] ^ ROL64(BC[MOD5(x+1)], 1);
261
+ for ( y = 0; y < 25; y += 5 )
262
+ {
263
+ state[y + x] ^= temp;
264
+ }
265
+ }
266
+
267
+ /* Rho Pi */
268
+ temp = state[1];
269
+ for ( x = 0; x < 24; ++x )
270
+ {
271
+ BC[0] = state[KeccakP1600_PiLane[x]];
272
+ state[KeccakP1600_PiLane[x]] = ROL64( temp, KeccakP1600_RotationConstants[x] );
273
+ temp = BC[0];
274
+ }
275
+
276
+ /* Chi */
277
+ for ( y = 0; y < 25; y += 5 )
278
+ {
279
+ #if defined(UNROLL_CHILOOP)
280
+ BC[0] = state[y + 0];
281
+ BC[1] = state[y + 1];
282
+ BC[2] = state[y + 2];
283
+ BC[3] = state[y + 3];
284
+ BC[4] = state[y + 4];
285
+ #else
286
+ for ( x = 0; x < 5; ++x )
287
+ {
288
+ BC[x] = state[y + x];
289
+ }
290
+ #endif
291
+ for ( x = 0; x < 5; ++x )
292
+ {
293
+ state[y + x] = BC[x] ^((~BC[MOD5(x+1)]) & BC[MOD5(x+2)]);
294
+ }
295
+ }
296
+
297
+ /* Iota */
298
+ state[0] ^= KeccakF1600_GetNextRoundConstant(&LFSRstate);
299
+ }
300
+ while( --round != 0 );
301
+ }
302
+
303
+ /* ---------------------------------------------------------------- */
304
+
305
+ void KeccakP1600_Permute_Nrounds(void *state, unsigned int nrounds)
306
+ {
307
+ UINT8 LFSRstate;
308
+ UINT8 nr;
309
+
310
+ LFSRstate = 0x01;
311
+ for ( nr = 24 - nrounds; nr != 0; --nr )
312
+ KeccakF1600_GetNextRoundConstant(&LFSRstate);
313
+ KeccakP1600_Permute_NroundsLFSR(state, nrounds, LFSRstate);
314
+ }
315
+
316
+ /* ---------------------------------------------------------------- */
317
+
318
+ void KeccakP1600_Permute_12rounds(void *state)
319
+ {
320
+ KeccakP1600_Permute_NroundsLFSR(state, 12, 0xD5);
321
+ }
322
+
323
+ /* ---------------------------------------------------------------- */
324
+
325
+ void KeccakP1600_Permute_24rounds(void *state)
326
+ {
327
+ KeccakP1600_Permute_NroundsLFSR(state, 24, 0x01);
328
+ }
329
+
330
+ /* ---------------------------------------------------------------- */
331
+
332
+ void KeccakP1600_ExtractBytesInLane(const void *state, unsigned int lanePosition, unsigned char *data, unsigned int offset, unsigned int length)
333
+ {
334
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
335
+ memcpy(data, ((UINT8*)&((tKeccakLane*)state)[lanePosition])+offset, length);
336
+ #else
337
+ tSmallUInt i;
338
+ tKeccakLane lane = ((tKeccakLane*)state)[lanePosition];
339
+ lane >>= offset*8;
340
+ for(i=0; i<length; i++) {
341
+ data[i] = lane & 0xFF;
342
+ lane >>= 8;
343
+ }
344
+ #endif
345
+ }
346
+
347
+ /* ---------------------------------------------------------------- */
348
+
349
+ void KeccakP1600_ExtractLanes(const void *state, unsigned char *data, unsigned int laneCount)
350
+ {
351
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
352
+ memcpy(data, state, laneCount*8);
353
+ #else
354
+ tSmallUInt i, j;
355
+ for(i=0; i<laneCount; i++)
356
+ {
357
+ for(j=0; j<(64/8); j++)
358
+ {
359
+ data[(i*8)+j] = (((const tKeccakLane*)state)[i] >> (8*j)) & 0xFF;
360
+ }
361
+ }
362
+ #endif
363
+ }
364
+
365
+ /* ---------------------------------------------------------------- */
366
+
367
+ void KeccakP1600_ExtractBytes(const void *state, unsigned char *data, unsigned int offset, unsigned int length)
368
+ {
369
+ SnP_ExtractBytes(state, data, offset, length, KeccakP1600_ExtractLanes, KeccakP1600_ExtractBytesInLane, 8);
370
+ }
371
+
372
+ /* ---------------------------------------------------------------- */
373
+
374
+ void KeccakP1600_ExtractAndAddBytesInLane(const void *state, unsigned int lanePosition, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
375
+ {
376
+ tSmallUInt i;
377
+ tKeccakLane lane = ((tKeccakLane*)state)[lanePosition];
378
+ lane >>= offset*8;
379
+ for(i=0; i<length; i++) {
380
+ output[i] = input[i] ^ (lane & 0xFF);
381
+ lane >>= 8;
382
+ }
383
+ }
384
+
385
+ /* ---------------------------------------------------------------- */
386
+
387
+ void KeccakP1600_ExtractAndAddLanes(const void *state, const unsigned char *input, unsigned char *output, unsigned int laneCount)
388
+ {
389
+ #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
390
+ tSmallUInt i;
391
+ for(i=0; i<laneCount; i++)
392
+ ((tKeccakLane*)output)[i] = ((tKeccakLane*)input)[i] ^ ((const tKeccakLane*)state)[i];
393
+ #else
394
+ tSmallUInt i, j;
395
+ for(i=0; i<laneCount; i++)
396
+ {
397
+ for(j=0; j<(64/8); j++)
398
+ {
399
+ output[(i*8)+j] = input[(i*8)+j] ^ ((((const tKeccakLane*)state)[i] >> (8*j)) & 0xFF);
400
+ }
401
+ }
402
+ #endif
403
+ }
404
+
405
+ /* ---------------------------------------------------------------- */
406
+
407
+ void KeccakP1600_ExtractAndAddBytes(const void *state, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length)
408
+ {
409
+ SnP_ExtractAndAddBytes(state, input, output, offset, length, KeccakP1600_ExtractAndAddLanes, KeccakP1600_ExtractAndAddBytesInLane, 8);
410
+ }
411
+
412
+ /* ---------------------------------------------------------------- */