Skip to content

N8Brooks/murmur_hash_3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

murmur_hash_3

A TypeScript implementation of unsigned 32-bit MurmurHash3.

Usage

murmurHash3

This function provides the MurmurHash3 value for a string key.

import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
import { murmurHash3 } from "https://deno.land/x/murmur_hash_3/mod.ts";

const hash = murmurHash3("deno");

assertEquals(hash, 3565573943);

A seed can be provided with the options parameter. The default seed is 0.

import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
import { murmurHash3 } from "https://deno.land/x/murmur_hash_3/mod.ts";

const hash = murmurHash3("deno", { seed: 42 });

assertEquals(hash, 3140446342);

Contributing

Feel free to contribute.

License

The MurmurHash3 algorithm is in the public domain.