13
13
void xorbuf(byte *buf, const byte *mask, size_t count)
15
if (((size_t)buf | (size_t)mask | count) % WORD_SIZE == 0)
16
XorWords((word *)buf, (const word *)mask, count/WORD_SIZE);
17
if (IsAligned<word32>(buf) && IsAligned<word32>(mask))
19
for (unsigned int i=0; i<count; i++)
19
if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned<word64>(buf) && IsAligned<word64>(mask))
21
for (i=0; i<count/8; i++)
22
((word64*)buf)[i] ^= ((word64*)mask)[i];
30
for (i=0; i<count/4; i++)
31
((word32*)buf)[i] ^= ((word32*)mask)[i];
39
for (i=0; i<count; i++)
24
43
void xorbuf(byte *output, const byte *input, const byte *mask, size_t count)
26
if (((size_t)output | (size_t)input | (size_t)mask | count) % WORD_SIZE == 0)
27
XorWords((word *)output, (const word *)input, (const word *)mask, count/WORD_SIZE);
30
for (unsigned int i=0; i<count; i++)
31
output[i] = input[i] ^ mask[i];
47
if (IsAligned<word32>(output) && IsAligned<word32>(input) && IsAligned<word32>(mask))
49
if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned<word64>(output) && IsAligned<word64>(input) && IsAligned<word64>(mask))
51
for (i=0; i<count/8; i++)
52
((word64*)output)[i] = ((word64*)input)[i] ^ ((word64*)mask)[i];
61
for (i=0; i<count/4; i++)
62
((word32*)output)[i] = ((word32*)input)[i] ^ ((word32*)mask)[i];
71
for (i=0; i<count; i++)
72
output[i] = input[i] ^ mask[i];
75
bool VerifyBufsEqual(const byte *buf, const byte *mask, size_t count)
80
if (IsAligned<word32>(buf) && IsAligned<word32>(mask))
83
if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned<word64>(buf) && IsAligned<word64>(mask))
86
for (i=0; i<count/8; i++)
87
acc64 |= ((word64*)buf)[i] ^ ((word64*)mask)[i];
93
acc32 = word32(acc64) | word32(acc64>>32);
96
for (i=0; i<count/4; i++)
97
acc32 |= ((word32*)buf)[i] ^ ((word32*)mask)[i];
103
acc8 = byte(acc32) | byte(acc32>>8) | byte(acc32>>16) | byte(acc32>>24);
106
for (i=0; i<count; i++)
107
acc8 |= buf[i] ^ mask[i];
35
111
#if !(defined(_MSC_VER) && (_MSC_VER < 1300))