diff --git a/src/crypto/siphash.h b/src/crypto/siphash.h --- a/src/crypto/siphash.h +++ b/src/crypto/siphash.h @@ -14,7 +14,8 @@ private: uint64_t v[4]; uint64_t tmp; - int count; + // Only the low 8 bits of the input size matter. + uint8_t count; public: /** Construct a SipHash calculator initialized with 128-bit key (k0, k1) */ diff --git a/src/crypto/siphash.cpp b/src/crypto/siphash.cpp --- a/src/crypto/siphash.cpp +++ b/src/crypto/siphash.cpp @@ -55,7 +55,7 @@ CSipHasher &CSipHasher::Write(const uint8_t *data, size_t size) { uint64_t v0 = v[0], v1 = v[1], v2 = v[2], v3 = v[3]; uint64_t t = tmp; - int c = count; + uint8_t c = count; while (size--) { t |= uint64_t(*(data++)) << (8 * (c % 8));