GitHub Twitter ZKHints
🟢 Recommended 🟡 Usable with caution 🔴 Not recommended

🔐 Hash Functions

NameTypeUse CaseZK-FriendlyRecommendImplementationsNotes
PoseidonPermutationMerkle Tree, Commitment, PRF🟢Circom, Arkworks, Halo2SNARK-native, fast in R1CS/PLONK
MiMCFeistel-likeMerkle Tree, PRF🟢Circom, ArkworksMinimal constraints per round
RescueSpongeHash, PRF🟡Halo2, WinterfellAlgebraic structure, STARK-friendly
PedersenEC-basedCommitment⚠️ Partial🟡Circom, Sapling, ArkworksCurve-dependent
SHA2/SHA3StandardCompatibility with EVM systems🔴CircomVery high cost in R1CS

🌲 Merkle Tree Primitives

VariantHash UsedZK-FriendlyRecommendImplementationsNotes
Poseidon MTPoseidon🟢Circom, NoirFully SNARK-native
MiMC MTMiMC🟢CircomLightweight and efficient
Pedersen MTPedersen⚠️ Moderate🟡SaplingLegacy zkApp use
SHA MTSHA2/SHA3🔴CircomExpensive in constraint count

🧾 Commitment Schemes

SchemeBindingHidingZK-FriendlyRecommendImplementationsNotes
Pedersen🟢Circom, ArkworksFast, curve-based
Poseidon-based🟢Noir, Halo2Fully arithmetized
KZG Commitment⚠️ Limited🟡PLONK (zkEVMs)Trusted setup required

📐 Polynomial-Related Primitives

PrimitiveUse CaseZK-FriendlyRecommendImplementationsNotes
FFTPolynomial commitment🟢PLONK, STARK systemsCore of modern SNARKs
Lagrange Interp.Witness construction🟢InternalUsed in identity checks
Kate CommitmentOpenings for poly evals🟡PLONK, zkEVMPairing-based, used in KZG

🔣 Bit-level Encodings

PrimitiveUse CaseZK-FriendlyRecommendImplementationsNotes
Bit DecompositionRange proofs, logic🟢Circom, Halo2Common, but costly
Field PackingEfficient encoding🟢Circom, ArkworksReduce input size

🔗 Application Mapping Quick Guide

ApplicationRecommended Primitive(s)Notes
Efficient Merkle TreePoseidon, MiMCAvoid SHA-based in ZK
Privacy-preserving commitmentPedersen, Poseidon-basedGroup or native
Range / logic constraintsBit DecompositionOptimize with custom gadgets
Public compatibility (EVM)SHA2, Keccak256Only if EVM compatibility needed
Polynomial-based proving systemFFT, KZG, Lagrange Interp.Backbone of PLONK/STARK

📊 Hash To Curve (Sha256 + Secp256k1)

Component Non-Linear Constraints Linear Constraints
hash_to_field 288,787 15,572
map_to_curve 147,600 5,202
hash_to_curve 586,502 26,091

Description

hash_to_curve(msg)

Input: msg, an arbitrary-length byte string.
Output: P, a point in the secp256k1 curve.

Steps:
1. u = hash_to_field(msg)
2. Q0 = map_to_curve(u[0])
3. Q1 = map_to_curve(u[1])
4. R = iso_map(Q0) + iso_map(Q1)
5. return P

📎 Legend

  • Use Case: Main application scenarios
  • ZK-Friendly: Designed for low constraints
  • Recommend: Developer priority recommendation
  • Implementations: Frameworks with mature implementations (Circom, Arkworks, Noir, Halo2, etc.)