mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-03-12 09:29:51 +00:00
Optimized keccak
This commit is contained in:
parent
0c2b7d6010
commit
cdc3206ee8
1 changed files with 12 additions and 8 deletions
|
@ -48,17 +48,21 @@ NOINLINE void keccakf(uint64_t* st)
|
|||
bc[3] = st[3] ^ st[8] ^ st[13] ^ st[18] ^ st[23];
|
||||
bc[4] = st[4] ^ st[9] ^ st[14] ^ st[19] ^ st[24];
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
uint64_t t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1);
|
||||
st[i + 0 ] ^= t;
|
||||
st[i + 5] ^= t;
|
||||
st[i + 10] ^= t;
|
||||
st[i + 15] ^= t;
|
||||
st[i + 20] ^= t;
|
||||
#define X(i) { \
|
||||
const uint64_t t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1); \
|
||||
st[i + 0 ] ^= t; \
|
||||
st[i + 5] ^= t; \
|
||||
st[i + 10] ^= t; \
|
||||
st[i + 15] ^= t; \
|
||||
st[i + 20] ^= t; \
|
||||
}
|
||||
|
||||
X(0); X(1); X(2); X(3); X(4);
|
||||
|
||||
#undef X
|
||||
|
||||
// Rho Pi
|
||||
uint64_t t = st[1];
|
||||
const uint64_t t = st[1];
|
||||
st[ 1] = ROTL64(st[ 6], 44);
|
||||
st[ 6] = ROTL64(st[ 9], 20);
|
||||
st[ 9] = ROTL64(st[22], 61);
|
||||
|
|
Loading…
Reference in a new issue