summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/LICENSE.siphash
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-01-31 10:36:34 +0100
committerLars Knoll <lars.knoll@qt.io>2020-04-09 20:03:45 +0200
commitf14559790b95506b1e3231ee6fc1d95b730d572c (patch)
tree09bb76df5f67850c7a071088b4a8a3d48a62b973 /src/corelib/tools/LICENSE.siphash
parent03d990fa157abbb5f7554a1e3c6404cf4d82f307 (diff)
Change qHashBits to use MurmurHash2
The old implementation was either using CRC32 on modern processors or a trivial, but rather slow implementation. We can't continue with CRC32, as that implementation can only give us 32bit hashes, where we now need to support 64bit in Qt 6. Change the implementation to use MurmurHash, as public domain implementation that is both very fast and leads to well distributed hashes. This hash function is about as fast as the SSE optimized CRC32 implementation but works everywhere and gives us 64 bit hash values. Here are some numbers (time for 10M hashes): 14 char 16 char QByteArray QString float old qHash (non CRC32) 127ms 134ms 48ms old qHash (using SSE CRC32 instructions 60ms 62ms 46ms new qHash 52ms 43ms 46ms Unfortunately MurmurHash is not safe against hash table DoS attacks, as potential hash collisions are indepenent of the seed. This will get addressed in followup commit, where we use SipHash or an SSE optimized AES based hashing algorithm that does not have those issues. Change-Id: I4fbc0ac299215b6db78c7a0a2a1d7689b0ea848b Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/tools/LICENSE.siphash')
0 files changed, 0 insertions, 0 deletions