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.2.tar.gz (5.4 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for gxhash-0.2.2.tar.gz
Algorithm Hash digest
SHA256 4bcf342c6520049ea7ad44c84b85e542109e7cc6576853f8830464a4affbbeb5
MD5 9961cf02029425c1b49b7fb4d16a8384
BLAKE2b-256 8cf4af10b2607a0c8f05b0581f3de9fb74a2a340bfec3545d8232f6e182b9849

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