vnmakarov / mum-hash Goto Github PK
View Code? Open in Web Editor NEWHashing functions and PRNGs based on them
Hashing functions and PRNGs based on them
Though, this platforms are going to die, there is still wide adoption of.
So, it should be mention, which performance to expect from Mum, compared for other well performed 32bit hash functions.
https://github.com/vnmakarov/mum-hash/blob/master/mum.h#L312-L320
There is no any guarantee, than _mum_next_factor
will return prime number.
Neither it is guaranteed to be odd (but it looks like algorithm doesn't depends on it).
If generator behind rand
is a good random generator, then _mem_next_factor
even
allowed to return zero.
Hi,
could you please benchmark against BLAKE2b and BLAKE2s if it's not too much hassle?
It tries to be a very fast cryptographically secure hash function. I believe it to be still ballpark 10x slower than MUM but it would be nice to know for sure! Of course it would also make sense to compare it with MUM512. Thanks in advance!
siphash maybe too heavy or slow to generate tcp syncookie, just a message authentication code can do it, syncookie not need second pre-image resistance or collision resistance, pre-image resistance may be enough, how to prove mum-hash can do it?
This code in the inner loop of the hash assumes _mum_primes has an infinite number of elements and will produce non-deterministic output for any key longer than ((16 + _MUM_UNROLL_FACTOR) * sizeof(uint64_t) + 7)
for (i = 0; i < n; i++)
result ^= _mum (_mum_le (((uint64_t *) str)[i]), _mum_primes[i]);
Modern Meow Hash (v0.4 and up) is actually faster than Mum on small inputs now in randomized testing. The version checked into this tree is a very old version and not representative of the current speed.
- Casey
I plugged in your v2 code into demerphq/smhasher and, unlike v1, it's failing most of its test suite. Have you tested it with that smhasher fork by any chance? It doesn't make sense to me that this would happen to the extent it is, so it may be something to do with the integration; I'll check that next unless you have an idea of what's going on.
Hello, I'd like to thank you for your hard work - I really like your algorithm.
However, I have a sort of question: I tried mum-hash to calculate shingles which implies a lot of hash calculations for individual words in some arbitrary text. It turns out, that mum-hash performs quite bad in these conditions: it is slower than xxhash64:
mum-hash:
(50000 words of 5 len, 0.02 perm factor): percentage of common shingles: 0.968, generate time: 0.0533 sec
(50000 words of 16 len, 0.02 perm factor): percentage of common shingles: 0.937, generate time: 0.0351 sec
xxhash64:
(50000 words of 5 len, 0.02 perm factor): percentage of common shingles: 0.781, generate time: 0.0330 sec
(50000 words of 16 len, 0.02 perm factor): percentage of common shingles: 0.906, generate time: 0.0361 sec
As you can see, for inputs that are not 'good' for hash the performance is reduced significantly. I think this is worth to mention in the documentation.
When compiling with the -wno-unused-value flag the following warning is produced:
mum.h:118:13: warning: right-hand operand of comma expression has no effect [-Wunused-value]
118 | lo = v * p, hi;
|
Claims to be 5x faster than SipHash, implementations:
In how to use MUM we can read:
The most often scenario I'm woking with is creating hashes for multiple continuous blocks of data.
How should I do that with MUM, it is not obvious from the source.
e.g. how to I get the single hash over the following arrays with the right combinations of mum functions ?
const uint8_t key_1 [1] = { 0 };
const uint8_t key_2 [2] = { 1, 2 };
const uint8_t key_3 [3] = { 1, 2, 3 };
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.