spookyhash | Thread safe and multi-endian version
kandi X-RAY | spookyhash Summary
kandi X-RAY | spookyhash Summary
It’s fast. For short keys it’s 1 byte per cycle, with a 30 cycle startup cost. For long keys, well, it would be 3 bytes per cycle, and that only occupies one core. Except you’ll hit the limit of how fast uncached memory can be read, which on my home machines is less than 2 bytes per cycle. It’s good. It achieves avalanche for 1-bit and 2-bit inputs. It works for any type of key that can be made to look like an array of bytes, or list of arrays of bytes. It takes a seed, so it can produce many different independent hashes for the same key. It can produce up to 128-bit results. Large systems should consider using 128-bit checksums nowadays. A library with 4 billion documents is expected to have about 1 colliding 64-bit checksum no matter how good the hash is. Libraries using 128-bit checksums should expect 1 collision once they hit 16 quintillion documents. (Due to limited hardware, I can only verify SpookyHash is as good as a good 73-bit checksum. It might be better, I can’t tell.). When NOT to use it: if you have an opponent. This is not cryptographic. Given a message, a resourceful opponent could write a tool that would produce a modified message with the same hash as the original message. Once such a tool is written, a not-so-resourceful opponent could borrow the tool and do the same thing. Another case not to use it: CRCs have a nice property that you can split a message up into pieces arbitrarily, calculate the CRC all the pieces, then afterwards combine the CRCs for the pieces to find the CRC for the concatenation of all those pieces. SpookyHash can’t. If you could deterministically choose what the pieces were, though, you could compute the hashes for pieces with SpookyHash (or CityHash or any other hash), then treat those hash values as the raw data, and do CRCs on top of that.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of spookyhash
spookyhash Key Features
spookyhash Examples and Code Snippets
#include "spookyhash_api.h"
void hash(void* data, size_t data_length) {
uint64_t seed1 = 0xabcdef, seed2 = 0xfedcba;
uint32_t seed3 = 0x12ab;
// Direct use example
spookyhash_128(data, data_length, &seed1, &seed2);
Community Discussions
Trending Discussions on spookyhash
QUESTION
I am implementing Spooky-hash on one of the applications I am building.
I am referencing the Golang and C libraries. These provide the output int the form of 2 unsigned 64bit integers.
When looking at the python implementation (which is a wrapper on the C++) implementation they are deriving a 128 big number and giving back an answer.
My problem is, what is python doing with the 2 64uint values to get this number?
I think this is the relevant C++ code (from the python wrapper) where it invokes the original C++ library:
...ANSWER
Answered 2019-Apr-23 at 11:34Convert those numbers to hex, and you will see the connection:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install spookyhash
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page