19NAMESPACE_BEGIN(CryptoPP)
22extern void KeccakF1600(word64 *state);
24extern const word64 KeccakF1600Constants[24];
28NAMESPACE_BEGIN(CryptoPP)
31const word64 KeccakF1600Constants[24] =
33 W64LIT(0x0000000000000001), W64LIT(0x0000000000008082),
34 W64LIT(0x800000000000808a), W64LIT(0x8000000080008000),
35 W64LIT(0x000000000000808b), W64LIT(0x0000000080000001),
36 W64LIT(0x8000000080008081), W64LIT(0x8000000000008009),
37 W64LIT(0x000000000000008a), W64LIT(0x0000000000000088),
38 W64LIT(0x0000000080008009), W64LIT(0x000000008000000a),
39 W64LIT(0x000000008000808b), W64LIT(0x800000000000008b),
40 W64LIT(0x8000000000008089), W64LIT(0x8000000000008003),
41 W64LIT(0x8000000000008002), W64LIT(0x8000000000000080),
42 W64LIT(0x000000000000800a), W64LIT(0x800000008000000a),
43 W64LIT(0x8000000080008081), W64LIT(0x8000000000008080),
44 W64LIT(0x0000000080000001), W64LIT(0x8000000080008008)
47void KeccakF1600(word64 *state)
49 word64 Aba, Abe, Abi, Abo, Abu;
50 word64 Aga, Age, Agi, Ago, Agu;
51 word64 Aka, Ake, Aki, Ako, Aku;
52 word64 Ama, Ame, Ami, Amo, Amu;
53 word64 Asa, Ase, Asi, Aso, Asu;
54 word64 BCa, BCe, BCi, BCo, BCu;
55 word64 Da, De, Di, Do, Du;
56 word64 Eba, Ebe, Ebi, Ebo, Ebu;
57 word64 Ega, Ege, Egi, Ego, Egu;
58 word64 Eka, Eke, Eki, Eko, Eku;
59 word64 Ema, Eme, Emi, Emo, Emu;
60 word64 Esa, Ese, Esi, Eso, Esu;
63 Block::Get(state)(Aba)(Abe)(Abi)(Abo)(Abu)(Aga)(Age)(Agi)(Ago)(Agu)(Aka)(Ake)(Aki)(Ako)(Aku)(Ama)(Ame)(Ami)(Amo)(Amu)(Asa)(Ase)(Asi)(Aso)(Asu);
65 for(
unsigned int round = 0; round < 24; round += 2 )
68 BCa = Aba^Aga^Aka^Ama^Asa;
69 BCe = Abe^Age^Ake^Ame^Ase;
70 BCi = Abi^Agi^Aki^Ami^Asi;
71 BCo = Abo^Ago^Ako^Amo^Aso;
72 BCu = Abu^Agu^Aku^Amu^Asu;
75 Da = BCu^rotlConstant<1>(BCe);
76 De = BCa^rotlConstant<1>(BCi);
77 Di = BCe^rotlConstant<1>(BCo);
78 Do = BCi^rotlConstant<1>(BCu);
79 Du = BCo^rotlConstant<1>(BCa);
84 BCe = rotlConstant<44>(Age);
86 BCi = rotlConstant<43>(Aki);
88 BCo = rotlConstant<21>(Amo);
90 BCu = rotlConstant<14>(Asu);
91 Eba = BCa ^((~BCe)& BCi );
92 Eba ^= KeccakF1600Constants[round];
93 Ebe = BCe ^((~BCi)& BCo );
94 Ebi = BCi ^((~BCo)& BCu );
95 Ebo = BCo ^((~BCu)& BCa );
96 Ebu = BCu ^((~BCa)& BCe );
99 BCa = rotlConstant<28>(Abo);
101 BCe = rotlConstant<20>(Agu);
103 BCi = rotlConstant<3>(Aka);
105 BCo = rotlConstant<45>(Ame);
107 BCu = rotlConstant<61>(Asi);
108 Ega = BCa ^((~BCe)& BCi );
109 Ege = BCe ^((~BCi)& BCo );
110 Egi = BCi ^((~BCo)& BCu );
111 Ego = BCo ^((~BCu)& BCa );
112 Egu = BCu ^((~BCa)& BCe );
115 BCa = rotlConstant<1>(Abe);
117 BCe = rotlConstant<6>(Agi);
119 BCi = rotlConstant<25>(Ako);
121 BCo = rotlConstant<8>(Amu);
123 BCu = rotlConstant<18>(Asa);
124 Eka = BCa ^((~BCe)& BCi );
125 Eke = BCe ^((~BCi)& BCo );
126 Eki = BCi ^((~BCo)& BCu );
127 Eko = BCo ^((~BCu)& BCa );
128 Eku = BCu ^((~BCa)& BCe );
131 BCa = rotlConstant<27>(Abu);
133 BCe = rotlConstant<36>(Aga);
135 BCi = rotlConstant<10>(Ake);
137 BCo = rotlConstant<15>(Ami);
139 BCu = rotlConstant<56>(Aso);
140 Ema = BCa ^((~BCe)& BCi );
141 Eme = BCe ^((~BCi)& BCo );
142 Emi = BCi ^((~BCo)& BCu );
143 Emo = BCo ^((~BCu)& BCa );
144 Emu = BCu ^((~BCa)& BCe );
147 BCa = rotlConstant<62>(Abi);
149 BCe = rotlConstant<55>(Ago);
151 BCi = rotlConstant<39>(Aku);
153 BCo = rotlConstant<41>(Ama);
155 BCu = rotlConstant<2>(Ase);
156 Esa = BCa ^((~BCe)& BCi );
157 Ese = BCe ^((~BCi)& BCo );
158 Esi = BCi ^((~BCo)& BCu );
159 Eso = BCo ^((~BCu)& BCa );
160 Esu = BCu ^((~BCa)& BCe );
163 BCa = Eba^Ega^Eka^Ema^Esa;
164 BCe = Ebe^Ege^Eke^Eme^Ese;
165 BCi = Ebi^Egi^Eki^Emi^Esi;
166 BCo = Ebo^Ego^Eko^Emo^Eso;
167 BCu = Ebu^Egu^Eku^Emu^Esu;
170 Da = BCu^rotlConstant<1>(BCe);
171 De = BCa^rotlConstant<1>(BCi);
172 Di = BCe^rotlConstant<1>(BCo);
173 Do = BCi^rotlConstant<1>(BCu);
174 Du = BCo^rotlConstant<1>(BCa);
179 BCe = rotlConstant<44>(Ege);
181 BCi = rotlConstant<43>(Eki);
183 BCo = rotlConstant<21>(Emo);
185 BCu = rotlConstant<14>(Esu);
186 Aba = BCa ^((~BCe)& BCi );
187 Aba ^= KeccakF1600Constants[round+1];
188 Abe = BCe ^((~BCi)& BCo );
189 Abi = BCi ^((~BCo)& BCu );
190 Abo = BCo ^((~BCu)& BCa );
191 Abu = BCu ^((~BCa)& BCe );
194 BCa = rotlConstant<28>(Ebo);
196 BCe = rotlConstant<20>(Egu);
198 BCi = rotlConstant<3>(Eka);
200 BCo = rotlConstant<45>(Eme);
202 BCu = rotlConstant<61>(Esi);
203 Aga = BCa ^((~BCe)& BCi );
204 Age = BCe ^((~BCi)& BCo );
205 Agi = BCi ^((~BCo)& BCu );
206 Ago = BCo ^((~BCu)& BCa );
207 Agu = BCu ^((~BCa)& BCe );
210 BCa = rotlConstant<1>(Ebe);
212 BCe = rotlConstant<6>(Egi);
214 BCi = rotlConstant<25>(Eko);
216 BCo = rotlConstant<8>(Emu);
218 BCu = rotlConstant<18>(Esa);
219 Aka = BCa ^((~BCe)& BCi );
220 Ake = BCe ^((~BCi)& BCo );
221 Aki = BCi ^((~BCo)& BCu );
222 Ako = BCo ^((~BCu)& BCa );
223 Aku = BCu ^((~BCa)& BCe );
226 BCa = rotlConstant<27>(Ebu);
228 BCe = rotlConstant<36>(Ega);
230 BCi = rotlConstant<10>(Eke);
232 BCo = rotlConstant<15>(Emi);
234 BCu = rotlConstant<56>(Eso);
235 Ama = BCa ^((~BCe)& BCi );
236 Ame = BCe ^((~BCi)& BCo );
237 Ami = BCi ^((~BCo)& BCu );
238 Amo = BCo ^((~BCu)& BCa );
239 Amu = BCu ^((~BCa)& BCe );
242 BCa = rotlConstant<62>(Ebi);
244 BCe = rotlConstant<55>(Ego);
246 BCi = rotlConstant<39>(Eku);
248 BCo = rotlConstant<41>(Ema);
250 BCu = rotlConstant<2>(Ese);
251 Asa = BCa ^((~BCe)& BCi );
252 Ase = BCe ^((~BCi)& BCo );
253 Asi = BCi ^((~BCo)& BCu );
254 Aso = BCo ^((~BCu)& BCa );
255 Asu = BCu ^((~BCa)& BCe );
258 Block::Put(NULLPTR, state)(Aba)(Abe)(Abi)(Abo)(Abu)(Aga)(Age)(Agi)(Ago)(Agu)(Aka)(Ake)(Aki)(Ako)(Aku)(Ama)(Ame)(Ami)(Amo)(Amu)(Asa)(Ase)(Asi)(Aso)(Asu);
Access a block of memory.
Classes for Keccak message digests.
Access a block of memory.