Circom libs in Python
Project description
circomlibpy
Circom libs in Python
Obtaining a Poseidon hash from two elements:
from circomlibpy.poseidon import PoseidonHash
poseidon = PoseidonHash()
hash = poseidon.hash(2, [12345, 67890])
Constructing a Merkle tree based on Poseidon hashes:
from circomlibpy.merkle_tree import MerkleTree
leafs: list[int] = [
[1, 2, 3],
[11, 22, 33],
]
mtree = MerkleTree(leafs)
path, order = mtree.gen_proof(index=0)
print(f'Root: {mtree.root}')
print(f'Path: {path}')
print(f'Order: {order}')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
circomlibpy-1.0.0.tar.gz
(905.2 kB
view hashes)
Built Distribution
circomlibpy-1.0.0-py3-none-any.whl
(906.1 kB
view hashes)
Close
Hashes for circomlibpy-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4ffcc3a74e7686cb335756976e757921efbe1e6bcb3858342536d1ac01d24b1 |
|
MD5 | 08667111a97e0496db3cb2bc718abd29 |
|
BLAKE2b-256 | f14f7408c12ea2bbb877fe20f777ba9ad0fd1ec67ae825aa2eb8bc006eaf711c |