338 std::array<BIT64, 5> RC;
339 RC[0] = (BIT64) 0x0000000000000000;
340 RC[1] = (BIT64) 0x13198A2E03707344;
341 RC[2] = (BIT64) 0xA4093822299F31D0;
342 RC[3] = (BIT64) 0x082EFA98EC4E6C89;
343 RC[4] = (BIT64) 0x452821E638D01377;
345 const BIT64 alpha = 0xC0AC29B7C97C50DD;
348 modk0 = (key0 & 0x1) << 63;
349 modk0 = modk0 | ((key0 & ~0x3) >> 1);
350 modk0 = modk0 | ((key0.b15>>3) ^ ((key0.b0 & 0x2)>>1));
352 runningmod = modifier;
353 workingval =
data^key0;
354 for (
int i=0;
i<=4;
i++) {
355 roundkey = key1 ^ runningmod;
356 workingval = workingval ^ roundkey;
357 workingval = workingval ^ RC[
i];
361 workingval =
PACMult(workingval);
363 workingval =
PACSub(workingval);
366 roundkey = modk0 ^ runningmod;
367 workingval = workingval ^ roundkey;
370 workingval =
PACMult(workingval);
371 workingval =
PACSub(workingval);
373 workingval =
PACMult(workingval);
374 workingval = key1 ^ workingval;
378 workingval =
PACMult(workingval);
380 workingval = workingval ^ key0;
381 workingval = workingval ^ runningmod;
383 for (
int i=0;
i<=4;
i++) {
386 workingval =
PACMult(workingval);
390 roundkey = key1 ^ runningmod;
391 workingval = workingval ^ RC[4-
i];
392 workingval = workingval ^ roundkey;
393 workingval = workingval ^ alpha;
395 workingval = workingval ^ modk0;