Browse Source

faster CipherBlock XOR implementation for non-AVX

pull/1260/head
orignal 6 years ago
parent
commit
a309eb9f3c
  1. 14
      libi2pd/Crypto.h

14
libi2pd/Crypto.h

@ -124,9 +124,17 @@ namespace crypto
else else
#endif #endif
{ {
// TODO: implement it better if (((size_t)buf | (size_t)other.buf) & 0x03) // multiple of 4 ?
for (int i = 0; i < 16; i++) {
buf[i] ^= other.buf[i]; // we are good to cast to uint32_t *
for (int i = 0; i < 4; i++)
((uint32_t *)buf)[i] ^= ((uint32_t *)other.buf)[i];
}
else
{
for (int i = 0; i < 16; i++)
buf[i] ^= other.buf[i];
}
} }
} }
}; };

Loading…
Cancel
Save