Skip to main content

Python bindings for GxHash

Project description

gxhash-py

uv python

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

pip

gxhash is available on PyPI and can be installed via pip.

pip install gxhash

For best performance, you can enable the hybrid by passing the following build-args to the --config-settings flag.

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

uv

If you are using uv, you can enable the hybrid feature by adding the following config-settings under the tool.uv section.

uv add gxhash
[tool.uv]
config-settings = { build-args = "--features hybrid" }

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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for gxhash-0.2.5.tar.gz
Algorithm Hash digest
SHA256 9af518ae39a71ac9646b9dcfa5913b3c21b33f6b6243e861ecfcfcefb971a9f9
MD5 05b7c711fc92e787f8d08dfed5a75f3d
BLAKE2b-256 0e4424bdbb667feeb1a9caf605083a0f8a6f77e2493856763dd38e5d6ef3e0d7

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