light-poseidon Python Bindings
Python bindings for light-poseidon, originally by Mike Rostecki. This package is a fork providing Python access to the Poseidon hash implementation for the BN254 curve.
Compatibility
This package is made to be compatible with Kusama Shield's PoseidonPolkaVM.
Installation
pip install light-poseidon
Usage
from light_poseidon_python import poseidon_hash, poseidon_hash_bytes, Hasher
# One-shot function with uint64 inputs
result = poseidon_hash([1, 2])
print(result) # 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a
# Byte inputs (32 bytes each, big-endian)
a = b"\x01" * 32
b = b"\x02" * 32
result = poseidon_hash_bytes([a, b])
# Reusable Hasher class
hasher = Hasher(2) # 2 inputs
result = hasher.hash([1, 2])
# Byte variants
hasher.hash_bytes_be([a, b]) # big-endian
hasher.hash_bytes_le([a, b]) # little-endian
Supported arities
1-12 inputs are supported.
Development
# Using Makefile
make install # Create venv and build
make test # Run basic tests
make build # Build wheel
make publish # Publish to PyPI
# Or manually
cd light-poseidon-python
python3 -m venv .venv
source .venv/bin/activate
pip install maturin
maturin develop
Release files for light-poseidon 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| light_poseidon-0.1.1.tar.gz | 358.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| light_poseidon-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.34+ x86-64 | Details |
Total release size: 1.1 MB
Release files / light_poseidon-0.1.1.tar.gz
| Download URL | light_poseidon-0.1.1.tar.gz |
|---|---|
| Size | 358.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca2386f6591d6a54408a2f46d5e6288bfb8a802be31a713b6a8acae254a6a805
|
|
BLAKE2b-256 checksum How to use checksums |
cc95576e0502057e717194930af570c89a69250a3744c2b82c178b6ccb7d3cee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|
Release files / light_poseidon-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | light_poseidon-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 702.2 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
83cad4e9ed1c557a7fa3149be6c74af85b1b8d9e3495db72bbb145e86635147b
|
|
BLAKE2b-256 checksum How to use checksums |
8a29d0d7574dd777f57e52765d2ef9cddeaf4c36ee30bc4f6b5dd5bb2c957f51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|