opyebEd25519Lab

Ed25519 and X25519: one curve, two jobs

Basics · 6 min read

In one line: What each of the two Curve25519 algorithms does, and why a key made from the same seed is not interchangeable between them.

Ed25519 and X25519 share a name shape and the same underlying curve, which invites the assumption that either one will do. In practice they perform different jobs and their keys cannot be swapped.

1. One curve, two computations

Curve25519 is an elliptic curve over a 255-bit prime field. Scalar multiplication on that curve is a single operation; what you do with the result gives you two algorithms.

Ed25519X25519
PurposeDigital signaturesKey exchange (ECDH)
Input32-byte seed + message32-byte private key + peer public key
Output64-byte signature32-byte shared secret
SpecificationRFC 8032RFC 7748
Point modelEdwards formMontgomery form

Ed25519 works with Edwards coordinates; X25519 uses only the x-coordinate of the Montgomery form. They describe the same curve in different models, and a key from one does not fit the other without an explicit conversion.

2. Does the same seed give the same key?

No. Both take 32 bytes, but they expand them differently.

Ed25519: h = SHA-512(seed) → clamp first 32 bytes → scalar a
X25519 : clamp the seed itself → scalar k

Ed25519 hashes the seed with SHA-512 before clamping; X25519 clamps the seed directly. Paste the same 32 bytes into both curves in Ed25519Lab and the public keys are completely different.

3. Choosing between them

  • Ed25519 — to prove that a message came from a holder of a key and was not altered: release signatures, token signing, audit logs.
  • X25519 — to create a secret that only two parties know: TLS 1.3 key agreement, messenger session setup, per-file encryption keys.

Real protocols use both. Signing establishes who the peer is; the exchange establishes what the traffic will be encrypted with.

4. Common mistakes

  • Feeding an Ed25519 public key to X25519 — no error is raised and a meaningless shared secret appears. There is no way to notice.
  • Using the shared secret as an encryption key — X25519 output is not uniform random; pass it through a KDF such as HKDF.
  • Storing seeds and public keys in one pile — they look alike but have different sensitivity and different access rules.

5. Checking it in Ed25519Lab

Choose Ed25519 in panel ① and generate: the seed, public key, JWK and PEMs all appear together. Switch the curve to X25519 with the same seed and the public key differs. Panel ④ derives a shared secret from two X25519 keys and verifies that both directions agree.

Making a key yourself shows the format differences immediately.

Open Ed25519Lab

Frequently asked questions

Can I convert an Ed25519 key into an X25519 key?

It is mathematically possible but not recommended. There is no standard conversion step for this purpose, and deriving both keys from one seed means a leak on one side endangers the other. Generate each for its own purpose.

Is Curve25519 the same thing as Ed25519?

Curve25519 is the curve. Ed25519 is the signature scheme built on it in Edwards form; X25519 is the key-exchange function built on it in Montgomery form.

References

Read next

0 bytes of your input sent to a server (advertising and affiliate widgets excluded)