Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.
/ fnv0 Public archive

python 3.7+ FNV0 hash library implemented in C through libffi

License

Notifications You must be signed in to change notification settings

fabien-marty/fnv0

Repository files navigation

fnv0

Caution

This project is now maintained in another organization: https://github.com/botify-labs/fnv-c

THIS REPOSITORY HERE IS THEREFORE IN ARCHIVE MODE

What is it?

Python 3.7+ is a FNV0 hash library implemented in C through libffi.

Features

  • speed: 4 000% faster than basic Python implementation, 40% faster than pyhash
  • portability:
    • tested with recent Python versions (3.7+)
    • compatible with ARM64 and avoid too agressive CPU optimizations
    • compatible with PyPy
  • two variants: 32bits (fnv0_32()) and 64bits (fnv0_64())

Non features

  • other hash algorithms (this library is about a specific algorithm)

How to install/use it?

pip install git+https://github.com/fabien-marty/fnv0.git#egg=fnv0
import fnv0

print(fnv0.fnv0_32(b"foo bar"))
print(fnv0.fnv0_64(b"foo bar"))

Function signatures / API

fnv0_32(data: bytes) -> int
fnv0_64(data: bytes) -> int

Dev

pip install -r dev-requirements.txt
python setup.py develop

# get all tasks (lint, test, clean...)
invoke --list

About

python 3.7+ FNV0 hash library implemented in C through libffi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published