murmurhash-wasm
    Preparing search index...

    Function hash32

    • Hashes a provided key with a seed using the MurmurHash3 algorithm yielding a 32-bit hash.

      Parameters

      • key: ArrayBufferLike

        The key to hash

      • seed: number

        The seed to use to hash

      Returns Buffer

      The hash in a Buffer containing a single unsigned 32-bit integer in big-endian format (UInt32BE)

      import { MurmurHash3 } from 'murmurhash-wasm';

      const key = Buffer.from('hello');
      const seed = 0;

      const hash = MurmurHash3.hash32(key, seed);

      const hex = hash.toString('hex');
      // '5844da46'
      const value = hash.readUInt32BE();
      // 1480907334
    • Hashes a provided key with a seed using the MurmurHash3 algorithm yielding a 32-bit hash. The key will be converted to a Buffer using Buffer.from().

      Parameters

      • key: string

        The key to hash

      • seed: number

        The seed to use to hash

      Returns Buffer

      The hash in a Buffer containing a single unsigned 32-bit integer in big-endian format (UInt32BE)

      import { MurmurHash3 } from 'murmurhash-wasm';

      const key = 'hello';
      const seed = 0;

      const hash = MurmurHash3.hash32(key, seed);

      const hex = hash.toString('hex');
      // '5844da46'
      const value = hash.readUInt32BE();
      // 1480907334