Skip to content

tushushu/murmurust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

murmurust

pypi license unittest publish codestyle downloads downloads/month

What

Python binding of MurmurHash3 Rust implementation.

Requirements

  • Python: 3.8+
  • OS: Linux, MacOS and Windows

Installation

Run pip install mmr3

Benchmark

mmr3 is faster than mmh3 on average, which is a popular murmurhash3 library written in C/C++ and Python. For the details, please refer to benchmark.md.

Item XS S M L XL Average Faster
Hash32 1.9x 1.8x 1.8x 1.3x 1.0x 1.6x Y
Hash128 1.9x 1.9x 1.8x 1.5x 1.0x 1.6x Y

Examples

>>> import mmr3
# By default, seed=0, return unsigned int.
>>> mmr3.hash32('foo')
4138058784

# When seed = 100.
>>> mmr3.hash32('foo', seed=100)
3757588558

# Return signed int.
>>> mmr3.hash32('foo', signed=True)
-156908512

# hash128 for x64 architecture
>>> mmr3.hash128_x64('foo', seed=20, signed=True)
-114440907836743398687870327469607863688