Digital Signature (Schnorr)
Statement
Let be a prime-order group with generator of order . Alice's key pair: private , public .
Signing message hash (with nonce ):
- Commitment:
- Response:
Verification — accept iff:
Correctness: .
Visualization
Parameters: group , , , private key , public key .
Sign message with hash , nonce :
| Step | Computation | Value |
|---|---|---|
| Commitment | ||
| Response |
Verification:
| Side | Computation | Value |
|---|---|---|
| LHS | ||
| RHS | , , , ... |
Recheck with exact values:
g=5, p=23, x=4, y=3, r=9, c=7
R = 5^9 mod 23 = 11
s = (9 + 7*4) mod 22 = 37 mod 22 = 15
g^s = 5^15 mod 23 = 19
y^c = 3^7 mod 23 = 2187 mod 23 = 9
R * y^c mod 23 = 11 * 9 mod 23 = 99 mod 23 = 7 <- mismatch
Adjust to use , : . Then , , . Verified.
Schnorr signature trace ():
| Variable | Value |
|---|---|
| Match? | YES |
Proof Sketch
-
Expand . Since , we have .
-
Factor . This uses the rule and the definition .
-
Recognise . By definition of the commitment step.
-
Combine. . The verifier checks exactly this.
-
Unforgeability. Without knowledge of , computing a valid for a given and requires solving the discrete log of .
Connections
Schnorr signatures rest on the Diffie–HellmanDiffie–HellmanAlice and Bob derive the same shared secret g^(ab) from public keys g^a and g^b in any commutative group.Read more → hard problem (discrete log). The commitment is the same construction as DH's public key. The verification equation is a linear relation in the exponent, analogous to Bezout's IdentityBezout's IdentityThe gcd of two integers is always an integer linear combination of those integersRead more → in the integers. RSA signatures (see RSA CorrectnessRSA CorrectnessDecryption recovers the plaintext: m^(ed) ≡ m (mod n) whenever ed ≡ 1 (mod φ(n)).Read more →) provide an alternative construction using modular inversion.
Lean4 Proof
/-- Schnorr correctness: g^(r + c*x) = g^r * (g^x)^c in any CommMonoid. -/
theorem schnorr_correct {G : Type*} [CommMonoid G] (g : G) (r c x : ℕ) :
g ^ (r + c * x) = g ^ r * (g ^ x) ^ c := by
rw [pow_add, show c * x = x * c from mul_comm c x, pow_mul]
/-- Concrete Schnorr verification: g=5, p=23, x=4, r=3, c=2, s=11.
Check s = r + c*x mod 22: 3 + 2*4 = 11 ✓ -/
example : (3 + 2 * 4) % 22 = 11 := by native_decide
/-- y = g^x = 5^4 mod 23 = 4. -/
example : 5 ^ 4 % 23 = 4 := by native_decideReferenced by
- One-Way FunctionCryptography
- Merkle TreeCryptography