Skip to content

RealOrangeOne/seahash-py

Repository files navigation

SeaHash

CI PyPI PyPI - Python Version PyPI - Wheel PyPI - Status PyPI - License

Python bindings to seahash - A blazingly fast, portable hash function with proven statistical guarantees.

Installation

pip install seahash

Wheels should be available for most platforms. If you need a wheel which isn't provided, raise an issue.

Compiling from source will require a Rust toolchain.

Usage

Hashing can be done in 2 ways:

Primitive functions

import seahash

# Plain hash
seahash.hash(b"123")

# Hash with custom seeds
seahash.hash_seeded(b"123", 4, 5, 6, 7)

Both methods return an int.

hashlib-compatible class

For convenience, a hashlib-compatible class is provided:

import seahash

s = seahash.SeaHash()

s.update(b"123")

s.digest()
s.hexdigest()

The underlying int digest can be obtained with intdigest.