Path: blob/main/foundations/06-elliptic-curves/connect/ed25519-ssh.ipynb
483 views
Connect: Ed25519 in SSH
Module 06 | Real-World Connections
When you run ssh-keygen -t ed25519, you generate a key pair on a twisted Edwards curve. EdDSA is deterministic by design, immune to the nonce-reuse attack that broke the PS3.
Introduction
Ed25519 is the recommended algorithm for SSH keys. It is an instance of EdDSA (Edwards-curve Digital Signature Algorithm) on the twisted Edwards curve Edwards25519, which is birationally equivalent to Curve25519.
What makes EdDSA special compared to ECDSA?
Deterministic: No random nonce is needed. The nonce is derived from the message and private key.
Fast: Complete addition formulas with no edge cases.
Immune to nonce-reuse: The PS3 attack (Break notebook) is impossible by construction.
Edwards Curves: A Different Form
A twisted Edwards curve has the equation:
For Ed25519: , so the curve is over with .
This is a different form of elliptic curve (not Weierstrass, not Montgomery), but it is still an elliptic curve with the same group structure. There is an explicit birational equivalence between Edwards25519 and Curve25519.
The Edwards form has a remarkable property: the addition law is complete, meaning the same formula works for all inputs (no special cases for doubling, adding inverses, or the identity). This simplifies implementation and side-channel protection.
EdDSA: Deterministic Signatures
EdDSA signing differs from ECDSA in a crucial way: the nonce is deterministic.
ECDSA: is random. Reuse catastrophe (PS3 hack).
EdDSA: where prefix is derived from the private key. Same always produces the same , but different messages produce different values.
The signing algorithm:
Private key: seed (32 bytes). Compute . The scalar is the actual private key; the prefix is used for nonce generation.
Public key: .
Nonce: (deterministic!).
Nonce point: .
Challenge: .
Signature response: .
Signature: .
Verification: check where .
Ed25519 vs ECDSA: Side-by-Side
| Property | ECDSA (secp256k1/P-256) | EdDSA (Ed25519) |
|---|---|---|
| Curve form | Weierstrass: | Twisted Edwards: |
| Nonce | Random (or RFC 6979) | Deterministic: |
| Nonce reuse | Catastrophic (PS3 hack) | Impossible by construction |
| Addition formula | Different cases for add/double | Unified (complete) formula |
| Side-channel resistance | Implementation-dependent | Easier by design |
| Signature size | 64 bytes | 64 bytes |
| Key size | 32 bytes private, 33/65 bytes public | 32 bytes private, 32 bytes public |
| Speed | Moderate | Fast |
| Used in | Bitcoin, Ethereum, TLS | SSH, Signal, Tor, TLS |
Concept Map: Module 06 Concepts in SSH/Ed25519
| Module 06 Concept | Ed25519 / SSH Application |
|---|---|
| Point addition | Edwards unified addition formula |
| Scalar multiplication | Key generation: public key |
| ECDLP hardness | Cannot recover private key from public key |
| Nonce-reuse vulnerability (Break) | Deterministic nonce eliminates the risk |
| Curve arithmetic | EdDSA sign: , verify: |
| Curve form choice | Edwards form enables complete, constant-time formulas |
Summary
| Concept | Key idea |
|---|---|
| Edwards25519 | A twisted Edwards curve over , birationally equivalent to Curve25519. |
| Deterministic nonce | EdDSA computes from the private key and message, making nonce reuse impossible by construction. |
| Complete addition formula | The Edwards addition law has no edge cases, which simplifies constant-time implementation. |
| EdDSA verification | The verifier checks where , binding the signature to both the message and public key. |
| Compact representation | Signatures are 64 bytes, keys are 32 bytes, and signing/verification is fast. |
| Lesson from ECDSA | Instead of relying on implementers to generate good nonces, Ed25519 eliminates the vulnerability at the design level. |
Ed25519 represents the lessons learned from ECDSA's operational fragility: instead of relying on implementers to generate good nonces, the protocol eliminates the vulnerability at the design level.
Back to Module 06: Elliptic Curves