Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

spongefish

> 编程语言
Open source

Fiat-Shamir for the masses.

100 stars0 likes2 views
WebsiteGitHub

About

Fiat-Shamir for the masses.

spongefish: a duplex sponge Fiat–Shamir library

Sponge FiSh (duplex sponge Fiat–Shamir) is a permutation-agnostic Fiat–Shamir library that believes in random oracles.

It implements duplex sponges for bytes (or prime fields) spec-compatible with draft-irtf-cfrg-fiat-shamir.

Quickstart

The simplest way to start is defining an interactive Argument, and then compile it with Narg:

…

Witness values exist only for the prover; prover_message turns witness values into plain values that can be used both by prover and verifier. verifier_message squeezes a challenge, and sample draws a uniformly random value using the prover's private randomness. check runs the verification equation.

The session identifier is automatically derived from the tag, the verifier must consume the whole NARG string. An unused challenge is a compile error.

Each prover and verifier messages, as well as the instance, must have associated codecs. See LengthPrefixed and #[derive(Codec)] for helpers in defining new codecs.

Crates

  • spongefish: the core library implementing draft-irtf-cfrg-fiat-shamir, together with the duplex sponge API.
  • spongefish-circuit: constraint builders for permutation-based relations.
  • spongefish-derive: derive macros for codecs and related traits.
  • spongefish-pow: proof‑of‑work helpers for deriving Fiat–Shamir challenges via grinding.

Duplex sponge

The duplex sponge construction allows absorb and squeeze over an alphabet implementing Unit. This is abstracted as DuplexSpongeInterface.

…

Hash statements

Hash preimage statements can be built via spongefish-circuit.

A PermutationRelation yields the constraints proving correct evaluations of query-answers for a permutation oracle. It is additionally possible to constrain the evaluations on algebraic relations:

…

Arguments with grinding

It is possible to augment the bits of soundnes with a proof of work using spongefish-pow:

…

verifier_message_pow internally squeezes a grinding seed, has the prover search for a nonce solving the grinding problem, then sends the nonce as a prover message, and returns a new verifier message. A Keccak strategy is available too, and the parallel feature will use multi-threading the search across threads.

Also in the box

  • FiatShamir:: runs an argument over another duplex sponge: the draft's Shake128 suite, overwrite-mode Keccak and Ascon12 behind feature flags, or the instantiations::{XOF, Hash} bridges for RustCrypto's ExtendableOutput and Digest.
  • ProverState and VerifierState for protocols that do not fit one body, including a proof followed by data the caller parses itself.
  • SessionId is a distinct type, so a tag cannot be passed where a derived identifier is expected; prove_with_session_id accepts one established elsewhere.
  • The sponge is generic over its alphabet: DuplexSponge over a Permutation on field elements, such as Poseidon2, runs the whole transcript natively in the field, seeded through EncodedSessionId.

Feature flags

Feature Default Description
turboshake128 ✓ The draft's SHAKE128 and TurboSHAKE128 suites, DefaultHash, Narg, and ProverState
getrandom ✓ Enables OS-seeded ProverState::new; with turboshake128, also enables Narg::prove
zeroize ✓ Enables sponge-state wiping where supported by the backend; standard decoding buffers and RNG seed buffers are always wiped on drop
derive #[derive(Codec)] and friends via spongefish-derive
rand rand_core trait adapters for PrivateRng
keccak Overwrite-mode duplex sponge over Keccak-f[1600]
ascon Overwrite-mode duplex sponge over the Ascon permutation
yolocrypto direct access to the duplex sponge

Status

The current codebase is unaudited and the API is being redesigned; expect breaking changes until the next release. Earlier revisions were reviewed by Radically Open Security and OpenZeppelin. See SECURITY.md for scope and private reporting, and the threat model for security guarantees, caller responsibilities, and assurance limits.

More information

See the crate documentation, the Ristretto Schnorr integration test, and the sumcheck integration test.

Funding

This project was funded through NGI0 Entrust, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program. Learn more at the NLnet project page.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustfiat-shamirsnarkzero-knowledge

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言