src/utils/murmur3.js
function murmur3(data, seed) {
  const tail = data.length - (data.length % 4);
  const c1 = 0xcc9e2d51;
  const c2 = 0x1b873593;
  let h1 = seed;
  let k1;

  for (let i = 0; i < tail; i += 4) {
    k1 = (data[i + 3] << 24)
      | (data[i + 2] << 16)
      | (data[i + 1] << 8)
      | data[i];
    k1 = mul32(k1, c1);
    k1 = rotl32(k1, 15);
    k1 = mul32(k1, c2);
    h1 ^= k1;
    h1 = rotl32(h1, 13);
    h1 = sum32(mul32(h1, 5), 0xe6546b64);
  }

  k1 = 0;
  switch (data.length & 3) {
    case 3:
      k1 ^= data[tail + 2] << 16;
    case 2:
      k1 ^= data[tail + 1] << 8;
    case 1:
      k1 ^= data[tail + 0];
      k1 = mul32(k1, c1);
      k1 = rotl32(k1, 15);
      k1 = mul32(k1, c2);
      h1 ^= k1;
  }

  h1 ^= data.length;
  h1 ^= h1 >>> 16;
  h1 = mul32(h1, 0x85ebca6b);
  h1 ^= h1 >>> 13;
  h1 = mul32(h1, 0xc2b2ae35);
  h1 ^= h1 >>> 16;

  if (h1 < 0)
    h1 += 0x100000000;

  return h1;
}
function murmur3(data, seed) {
  const tail = data.length - (data.length % 4);
  const c1 = 0xcc9e2d51;
  const c2 = 0x1b873593;
  let h1 = seed;
  let k1;

  for (let i = 0; i < tail; i += 4) {
    k1 = (data[i + 3] << 24)
      | (data[i + 2] << 16)
      | (data[i + 1] << 8)
      | data[i];
    k1 = mul32(k1, c1);
    k1 = rotl32(k1, 15);
    k1 = mul32(k1, c2);
    h1 ^= k1;
    h1 = rotl32(h1, 13);
    h1 = sum32(mul32(h1, 5), 0xe6546b64);
  }

  k1 = 0;
  switch (data.length & 3) {
    case 3:
      k1 ^= data[tail + 2] << 16;
    case 2:
      k1 ^= data[tail + 1] << 8;
    case 1:
      k1 ^= data[tail + 0];
      k1 = mul32(k1, c1);
      k1 = rotl32(k1, 15);
      k1 = mul32(k1, c2);
      h1 ^= k1;
  }

  h1 ^= data.length;
  h1 ^= h1 >>> 16;
  h1 = mul32(h1, 0x85ebca6b);
  h1 ^= h1 >>> 13;
  h1 = mul32(h1, 0xc2b2ae35);
  h1 ^= h1 >>> 16;

  if (h1 < 0)
    h1 += 0x100000000;

  return h1;
}
function murmur3 ( data , seed ) { const tail = data . length - ( data . length % 4 ) ; const c1 = 0xcc9e2d51 ; const c2 = 0x1b873593 ; let h1 = seed ; let k1 ; for ( let i = 0 ; i < tail ; i += 4 ) { k1 = ( data [ i + 3 ] << 24 ) | ( data [ i + 2 ] << 16 ) | ( data [ i + 1 ] << 8 ) | data [ i ] ; k1 = mul32 ( k1 , c1 ) ; k1 = rotl32 ( k1 , 15 ) ; k1 = mul32 ( k1 , c2 ) ; h1 ^= k1 ; h1 = rotl32 ( h1 , 13 ) ; h1 = sum32 ( mul32 ( h1 , 5 ) , 0xe6546b64 ) ; } k1 = 0 ; switch ( data . length & 3 ) { case 3 : k1 ^= data [ tail + 2 ] << 16 ; case 2 : k1 ^= data [ tail + 1 ] << 8 ; case 1 : k1 ^= data [ tail + 0 ] ; k1 = mul32 ( k1 , c1 ) ; k1 = rotl32 ( k1 , 15 ) ; k1 = mul32 ( k1 , c2 ) ; h1 ^= k1 ; } h1 ^= data . length ; h1 ^= h1 >>> 16 ; h1 = mul32 ( h1 , 0x85ebca6b ) ; h1 ^= h1 >>> 13 ; h1 = mul32 ( h1 , 0xc2b2ae35 ) ; h1 ^= h1 >>> 16 ; if ( h1 < 0 ) h1 += 0x100000000 ; return h1 ; }
Murmur3 hash.
@alias module:utils.murmur3
@param {Buffer} data
@param {Number} seed
@returns {Number}
Murmur3 hash .