Skip to main content

Python bindings for GxHash

Project description

gxhash-py

Python bindings for GxHash, a blazingly fast and robust non-cryptographic hashing algorithm.

Features

  • Blazingly Fast: Minimal-overhead binding to leverage the full speed of GxHash.
  • Zero Python: Pure Rust backend with zero additional Python runtime overhead.
  • Async-Ready: Tokio-powered async hashing for fast and efficient concurrency.
  • Fully Typesafe: Predictable, clean API with complete type safety.

Installation

You must have rustup installed and set to nightly.

pip install gxhash

For the best performance, you can enable the hybrid feature with the following.

pip install gxhash --config-settings build-args="--features hybrid"

By default, gxhash uses your system's vectorisation features. You can disable this by setting the relevant RUSTFLAGS.

RUSTFLAGS="-C target-cpu=x86-64 -C target-feature=+aes,+avx2" pip install gxhash

Usage

Hashing bytes.

from gxhash import GxHash32

def main():
    gxhash = GxHash32(seed=0)
    result = gxhash.hash(b"Hello, world!")

if __name__ == "__main__":
    main()

Hashing bytes asynchronously.

from asyncio import run
from gxhash import GxHash128

async def main():
    gxhash = GxHash128(seed=0)
    result = await gxhash.hash_async(b"Hello, world!")

if __name__ == "__main__":
    run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gxhash-0.2.3.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file gxhash-0.2.3.tar.gz.

File metadata

  • Download URL: gxhash-0.2.3.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.6

File hashes

Hashes for gxhash-0.2.3.tar.gz
Algorithm Hash digest
SHA256 27d3e1f6ac43f90a46085599be1f21c7b58cdf4dae4c038014d0a60e7d76f02a
MD5 a6216f9d99cdfd3e445c8fd0d1e78bcd
BLAKE2b-256 e9e214ea63a51901aa1b34b1ee627b3985d176926ce9d20a8d6544fc9ea68fb6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page