minor stuff

This commit is contained in:
Adam Ierymenko 2020-03-15 19:44:40 -07:00
parent cf24ed4108
commit a7409486bb
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
2 changed files with 12 additions and 12 deletions

View file

@ -93,13 +93,13 @@ bool _v1_identity_generate_cond(const void *in,const unsigned int len)
#if __BYTE_ORDER == __BIG_ENDIAN
b[0] = Utils::swapBytes(b[0]);
b[1] = Utils::swapBytes(b[0]);
b[2] = Utils::swapBytes(b[0]);
b[3] = Utils::swapBytes(b[0]);
b[4] = Utils::swapBytes(b[0]);
b[5] = Utils::swapBytes(b[0]);
b[6] = Utils::swapBytes(b[0]);
b[7] = Utils::swapBytes(b[0]);
b[1] = Utils::swapBytes(b[1]);
b[2] = Utils::swapBytes(b[2]);
b[3] = Utils::swapBytes(b[3]);
b[4] = Utils::swapBytes(b[4]);
b[5] = Utils::swapBytes(b[5]);
b[6] = Utils::swapBytes(b[6]);
b[7] = Utils::swapBytes(b[7]);
#endif
Speck128<24> s16;
@ -113,12 +113,12 @@ bool _v1_identity_generate_cond(const void *in,const unsigned int len)
uint64_t y2 = b[i + 5];
uint64_t x3 = b[i + 6];
uint64_t y3 = b[i + 7];
x0 += x1;
x1 += x2;
i += 8;
x0 += x1; // mix parallel 128-bit blocks
x1 += x2;
x2 += x3;
x3 += y0;
s16.encrypt512(x0,y0,x1,y1,x2,y2,x3,y3);
s16.encryptXYXYXYXY(x0,y0,x1,y1,x2,y2,x3,y3);
b[i] = x0;
b[i + 1] = y0;
b[i + 2] = x1;
@ -147,7 +147,7 @@ bool _v1_identity_generate_cond(const void *in,const unsigned int len)
#if __BYTE_ORDER == __BIG_ENDIAN
return ((Utils::swapBytes(b[0]) + Utils::swapBytes(b[1])) >> 56U) == 0;
#else
return ((b[0] + b[1]) >> 56U) == 0;
return ((b[0] + b[1]) & 0xffU) == 0;
#endif
}

View file

@ -98,7 +98,7 @@ public:
/**
* Encrypt 512 bits in parallel with the same key
*/
ZT_INLINE void encrypt512(uint64_t &x0,uint64_t &y0,uint64_t &x1,uint64_t &y1,uint64_t &x2,uint64_t &y2,uint64_t &x3,uint64_t &y3) const noexcept
ZT_INLINE void encryptXYXYXYXY(uint64_t &x0,uint64_t &y0,uint64_t &x1,uint64_t &y1,uint64_t &x2,uint64_t &y2,uint64_t &x3,uint64_t &y3) const noexcept
{
for (int i=0;i<R;++i) {
const uint64_t kk = _k[i];