百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

spongefish

> 编程语言
开源

Fiat-Shamir 适用于大众。

100 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Fiat-Shamir 适用于大众。

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustfiat-shamirsnarkzero-knowledge

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

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