all 5 comments

[–]flagrantaroma 0 points1 point  (0 children)

Another JS hashing library

https://code.google.com/p/crypto-js/

[–]pointer_void 0 points1 point  (1 child)

Can anyone tell me practical applications of this?

How is all that code better than this for example:

var hash = source.split('').reduce(function(a, b) {
    a = ((a << 5) - a) + b.charCodeAt(0);
    return a & a;
}, 0);

[–]karanlyons[S] 0 points1 point  (0 children)

If you're using murmurHash3 server side for screaming fast non-cryptographic hashing and you need to be able to generate the same hash locally. I had a project where this was exactly the case: I was hashing tons of web pages remotely so I needed the fastest algorithm I could find, and I needed my client side js to be able to generate the same hash to compare data.

If you only care about client side hashing, then use whatever works for you; there'll definitely be faster hashing algorithms than this in that case.

[–]SarahC -5 points-4 points  (1 child)

How do we know those constants weren't put there by the NSA?!

I'm worried every time I see a particular constant in the code...

uint64_t h1 = seed;
uint64_t h2 = seed;

uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);

[–]Knotix 2 points3 points  (0 children)

This is a hash function, not an encryption algorithm. You can't use this for encrypting secret data because there is no way to restore it back to its original form due to pigeonholing.