Fiat-Shamir 适用于大众。
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.
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.
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.The duplex sponge construction allows absorb and squeeze over an alphabet implementing Unit. This is abstracted as DuplexSpongeInterface.
…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:
…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.
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.DuplexSponge over a
Permutation on field elements, such as Poseidon2, runs the whole
transcript natively in the field, seeded through EncodedSessionId.| 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 |
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.
See the crate documentation, the Ristretto Schnorr integration test, and the sumcheck integration test.
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,或尚未同步最近议题。