Glossary

Pedersen Hash

A Pedersen hash is an algebraic hash function based on elliptic curve operations, used in zero-knowledge proof systems.

Key Takeaways

  • A Pedersen hash maps inputs to elliptic curve points using multi-scalar multiplication, making it efficient inside arithmetic circuits used by zero-knowledge proof systems.
  • Unlike SHA-256 or other bitwise hash functions, Pedersen hashing operates on native finite field elements, avoiding the expensive bit decomposition that makes traditional hash functions costly in ZK circuits.
  • Pedersen hashes are distinct from Pedersen commitments: the hash has no blinding factor and is used for collision-resistant mapping, while the commitment adds randomness to hide the committed value.

What Is a Pedersen Hash?

A Pedersen hash is a cryptographic hash function that maps inputs to points on an elliptic curve using a linear combination of pre-defined generator points. The input is split into fixed-size chunks, each chunk is used as a scalar multiplier for a corresponding generator point, and the resulting curve points are summed together. The output is an elliptic curve point (or one of its coordinates extracted as a field element).

The construction was first described by Torben Pedersen in 1991, alongside the closely related Pedersen commitment scheme. While the commitment scheme is designed for hiding values, the Pedersen hash is designed for collision resistance: given fixed, publicly known generators, it is computationally infeasible to find two different inputs that produce the same output, as long as the discrete logarithm problem remains hard on the chosen curve.

The reason Pedersen hashing matters for modern cryptography is efficiency inside zero-knowledge proof circuits. Traditional hash functions like SHA-256 rely on bitwise operations (XOR, rotation, shifts) that map poorly to the arithmetic circuits used in SNARKs and STARKs. A single SHA-256 evaluation can require tens of thousands of constraints in a circuit. Pedersen hashing, by contrast, uses only field multiplications and point additions: operations that are native to the arithmetic field, requiring far fewer constraints.

How It Works

The core idea is to encode the input message as a sequence of scalar values, then compute a weighted sum of elliptic curve generator points. The process follows these steps:

  1. Choose a set of independent generator points G_0, G_1, ..., G_k on an elliptic curve. These generators are derived deterministically (for example, by hashing sequential indices) so that no one knows the discrete logarithm relationships between them.
  2. Split the input message M into fixed-size segments m_0, m_1, ..., m_k. Each segment is interpreted as an integer.
  3. Compute the hash as the elliptic curve point: H(M) = m_0 * G_0 + m_1 * G_1 + ... + m_k * G_k.
  4. Extract the output: either use the full curve point or take one coordinate (typically the x-coordinate) as the hash digest.

Windowed Construction

In practice, implementations use a windowed approach to improve efficiency. Instead of processing one bit at a time, the input is split into multi-bit windows (typically 3 or 4 bits wide). For each window, pre-computed lookup tables store the multiples of the corresponding generator point.

Zcash's Sapling protocol uses 3-bit windows on the Jubjub curve, while the iden3/Circom ecosystem standardized a 4-bit window variant on the Baby Jubjub curve. The 4-bit window approach requires fewer constraints per bit inside a circuit, at the cost of larger lookup tables.

// Simplified Pedersen hash construction (pseudocode)
// Input: message bits M, generators G[0..k]
function pedersen_hash(M, generators):
    // Split M into 3-bit windows
    windows = split_into_chunks(M, window_size=3)
    result = POINT_AT_INFINITY

    for i, w in enumerate(windows):
        // w is an integer in [0, 7] for 3-bit windows
        scalar = encode_window(w)
        result = result + scalar * generators[i]

    return result  // elliptic curve point

Security Properties

The collision resistance of a Pedersen hash reduces to the discrete logarithm problem on the underlying elliptic curve. Finding a collision requires computing the discrete log relationship between two generator points, which is assumed to be computationally infeasible for properly chosen curves.

One important caveat: the Pedersen hash is not a general-purpose hash function in the traditional sense. It operates on fixed-length inputs within a specific finite field. If inputs exceed the expected size or fall outside the valid scalar range, the hash can lose collision resistance. Research by NCC Group demonstrated practical collision attacks when implementations fail to enforce input length constraints properly.

Pedersen Hash vs. Pedersen Commitment

These two constructions share the same mathematical foundation but serve different purposes:

PropertyPedersen HashPedersen Commitment
FormulaH = m_0*G_0 + m_1*G_1 + ... + m_k*G_kC = v*G + r*H (with blinding factor r)
HidingNo: output is deterministic given the inputYes: the random blinding factor hides the value
BindingCollision-resistant (computationally binding)Computationally binding
Primary useMerkle trees, nullifier derivation, address hashingHiding transaction values, range proofs
HomomorphicAdditive (but typically not exploited)Additive: C(a) + C(b) = C(a+b)

The Pedersen commitment adds a blinding factor r multiplied by an independent generator H. This randomness makes the commitment unconditionally hiding: even with unlimited computational power, an observer cannot determine the committed value without knowing r. The Pedersen hash omits this blinding factor entirely, making the output deterministic and suitable for use as a hash function.

Use Cases

Zcash Sapling: Note Commitments and Nullifiers

Zcash's Sapling upgrade uses Pedersen hashing extensively on the Jubjub curve (a twisted Edwards curve embedded in the BLS12-381 scalar field). Note commitments are computed using a windowed Pedersen hash over the note's value, diversified payment address, and randomness. The hash output is inserted as a leaf in a Merkle tree, allowing membership proofs inside zk-SNARK circuits.

Nullifier derivation also depends on Pedersen hashing. The nullifier (a unique tag that marks a note as spent without revealing which note it is) is derived by mixing the note commitment and its tree position through a Pedersen hash, then applying a pseudorandom function keyed by the spending key. This ensures each note produces a unique, unlinkable nullifier.

StarkNet: State Trie Hashing

StarkNet originally used Pedersen hashing for its state commitment Merkle-Patricia tries. Contract storage slots, class hashes, and nonces were hashed using the Pedersen function to build the global state tree. More recent versions of the protocol have transitioned the top-level state commitment to Poseidon hashing, which offers even lower constraint counts in STARK circuits, though Pedersen remains in use for per-contract leaf hashing.

Aztec Protocol: Private Notes

Aztec uses Pedersen hashing on the Grumpkin curve (an embedded curve for BN254) to compute note commitments in its private UTXO system. The generators are derived from sequential Keccak-256 outputs, and the resulting hashes serve as leaves in the protocol's note hash tree. The Noir programming language exposes Pedersen hash and commitment functions as standard library primitives for circuit developers.

Merkle Trees in ZK Circuits

Any zero-knowledge proof system that needs to prove membership in a set typically uses a Merkle tree with a ZK-friendly hash function. Pedersen hashing is a common choice for the internal node hash in these trees because verifying a Merkle path requires evaluating the hash function at each tree level inside the circuit. With Pedersen hashing, each level adds only a few hundred constraints, compared to tens of thousands for SHA-256.

Comparison with Other ZK-Friendly Hashes

Pedersen hashing was one of the earliest algebraic hash functions adopted for ZK circuits, but it is not the only option. Newer alternatives trade different properties:

Hash FunctionCircuit CostNative SpeedUsed By
PedersenLow (~1,500 constraints for 256-bit input)ModerateZcash Sapling, Aztec, early StarkNet
PoseidonVery low (~250 constraints)ModerateStarkNet (current), Polygon zkEVM, Scroll
MiMCLowModerateTornado Cash, Semaphore v1
SHA-256Very high (~25,000+ constraints)FastBitcoin, general-purpose hashing

Poseidon has largely overtaken Pedersen as the preferred ZK-friendly hash in newer protocols because it achieves even lower constraint counts using a sponge construction over field elements. However, Pedersen remains in widespread use in deployed systems, and its security properties are well understood after years of production deployment.

Risks and Considerations

Input Domain Restrictions

Pedersen hashes operate on a fixed input domain defined by the number of generators and the window size. If an implementation accepts inputs outside this domain (for example, scalars larger than the curve's subgroup order), collisions can be trivially constructed by adding multiples of the group order to any scalar. Implementations must validate that inputs fall within the expected range.

Not a General-Purpose Hash

Pedersen hashing is not suitable as a drop-in replacement for SHA-256 or BLAKE2 in general-purpose applications. It lacks properties like pseudorandomness and preimage resistance guarantees that traditional hash functions provide. Its strength is specifically within arithmetic circuit contexts where field-native operations matter.

Curve Dependency

The security of a Pedersen hash is tied to the discrete logarithm hardness of the underlying curve. If advances in cryptanalysis (or quantum computing via Shor's algorithm) weaken the curve, the hash loses collision resistance. This concern applies to all elliptic-curve-based cryptographic primitives, not just Pedersen hashing.

Transition to Poseidon

Several protocols that initially adopted Pedersen hashing have migrated or are migrating to Poseidon. StarkNet transitioned its top-level state commitment to Poseidon, and Zcash's Orchard upgrade (successor to Sapling) uses the Sinsemilla hash function instead of Pedersen. Developers building new ZK systems should evaluate whether Poseidon or another modern algebraic hash better fits their constraint budget before choosing Pedersen.

Why It Matters

Pedersen hashing is a foundational building block for privacy-preserving cryptocurrency protocols. By enabling efficient Merkle tree verification inside ZK circuits, it makes practical the shielded transactions in Zcash, the private state proofs in StarkNet, and the confidential notes in Aztec. Without ZK-friendly hash functions like Pedersen, proving statements about hidden data would require orders of magnitude more computation, making privacy features impractical at scale.

For a deeper look at how zero-knowledge proofs apply to Bitcoin and related systems, see the research article on zero-knowledge proofs and Bitcoin applications. Developers working with ZK-rollups or privacy protocols should understand Pedersen hashing as the baseline against which newer alternatives like Poseidon are measured.

This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.