poseidon
Version, currently main branch1 version
- main branchlatestDec 11, 2020
github.com/guipublic/poseidon
Crystal library implementing Poseidon hash
Installation
# Add this to your shard.yml
dependencies:
poseidon:
github: guipublic/poseidon
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.35.1- License
- MIT
- Author
- Guillaume Drevon
Dependencies
Runtime Dependencies
- ecdsa*github: sikoba/ecdsa.cr
README
Poseidon hash
Poseidon is a zero-knowledge friendly hash, defined in the following research paper.
We propose here a crystal implementation based on the reference implementation. We also includes the sponge construction so that arbitrary input length hash can be computed.
Usage
Instantiate the class Poseidon with a prime number and the number of desired bits of security. Optionally one can specify the sponge capacity and the width of the permutation (in number of field elements). The hashing function requires a PoseidonParameters object, which can be retrieved by calling the auto_parameters function. Parameters can be fully customized by initialising a PoseidonParams object and calling the set_params function. In that case, one must also set the round constants that can either be provided with the set_round_constants function or auto-generated. If the round constants are generated, you must call init_generator() before computing the hash.
Please note that the mds matrix is not generated, it is hardcoded for only a few values of field size and permutation width. In case of, one can set it with the set_mds_matrix function.
You can also refer to the examples in spec.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Dec 11, 2020
- Crystal
0.35.1- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/guipublic/poseidon
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 17, 2026
- Synced
- Aug 17, 2026
- Versions
- 1