Skip to content
NOUMENResearch
Network
Engineering
, home page

A river delta seen from above, its channels joining and parting. A hybrid key exchange joins two shared secrets into one. Generated image. Shows no real place.

Experiment 8

Two key exchanges, one secret.

Step through the hybrid key exchange TLS 1.3 uses with X25519 and ML-KEM-768. The keys are made for real in your browser.

Experiment 8Hybrid key exchange

Instrument

  1. 1. Client makes two key pairs

    • ML-KEM-768 encapsulation key: 1,184 bytes
    • X25519 public key: 32 bytes
    • Total: 1,216 bytes
  2. 2. ClientHello, key share X25519MLKEM768 →

    • ML-KEM-768 encapsulation key: 1,184 bytes
    • X25519 public key: 32 bytes
    • Total: 1,216 bytes
  3. 3. Server encapsulates and does X25519

    • ML-KEM ciphertext: 1,088 bytes
    • X25519 public key: 32 bytes
    • Total: 1,120 bytes
  4. 4. ServerHello, key share ←

    • ML-KEM ciphertext: 1,088 bytes
    • X25519 public key: 32 bytes
    • Total: 1,120 bytes
  5. 5. Client decapsulates and does X25519

    • ML-KEM shared secret: 32 bytes
    • X25519 shared secret: 32 bytes
    • Total: 64 bytes
  6. 6. Both combine the two secrets

    • ML-KEM shared secret: 32 bytes
    • X25519 shared secret: 32 bytes
    • Total: 64 bytes
A TLS 1.3 handshake with the hybrid group X25519MLKEM768, as a sequence diagram. Post-quantum parts in blue, classical parts in ink. Bars are drawn to scale in bytes.

Reading

Press Next step to run a handshake. The page makes real keys with X25519 and ML-KEM-768 in your browser.

Step
0 of 6
Sent by the client
1,216 bytes (X25519 alone: 32)
Sent by the server
1,120 bytes (X25519 alone: 32)
Shared secret
64 bytes: 32 from ML-KEM-768, then 32 from X25519
Operations
not run yet

Your browser is not running script, so this is a finished run of the experiment.

Instrument

  1. 1. Client makes two key pairs

    • ML-KEM-768 encapsulation key: 1,184 bytes
    • X25519 public key: 32 bytes
    • Total: 1,216 bytes
  2. 2. ClientHello, key share X25519MLKEM768 →

    • ML-KEM-768 encapsulation key: 1,184 bytes
    • X25519 public key: 32 bytes
    • Total: 1,216 bytes
  3. 3. Server encapsulates and does X25519

    • ML-KEM ciphertext: 1,088 bytes
    • X25519 public key: 32 bytes
    • Total: 1,120 bytes
  4. 4. ServerHello, key share ←

    • ML-KEM ciphertext: 1,088 bytes
    • X25519 public key: 32 bytes
    • Total: 1,120 bytes
  5. 5. Client decapsulates and does X25519

    • ML-KEM shared secret: 32 bytes
    • X25519 shared secret: 32 bytes
    • Total: 64 bytes
  6. 6. Both combine the two secrets

    • ML-KEM shared secret: 32 bytes
    • X25519 shared secret: 32 bytes
    • Total: 64 bytes
A TLS 1.3 handshake with the hybrid group X25519MLKEM768, as a sequence diagram. Post-quantum parts in blue, classical parts in ink. Bars are drawn to scale in bytes.

Reading

Each side joins the ML-KEM secret and then the X25519 secret into 64 bytes, which TLS 1.3 puts through its key derivation. The hybrid is meant to hold as long as either of the two parts holds.

Step
6 of 6
Sent by the client
1,216 bytes (X25519 alone: 32)
Sent by the server
1,120 bytes (X25519 alone: 32)
Shared secret
64 bytes: 32 from ML-KEM-768, then 32 from X25519
Operations
not run (no script)

Method

This is the key exchange part of a TLS 1.3 handshake with the hybrid group X25519MLKEM768 (codepoint 4588, 0x11EC), as RFC 10024 defines it. The client sends an ML-KEM-768 encapsulation key followed by an X25519 public key, 1,216 bytes. The server answers with an ML-KEM ciphertext followed by its X25519 public key, 1,120 bytes. Each side ends with the ML-KEM shared secret followed by the X25519 shared secret, 64 bytes, which TLS 1.3 puts through its key derivation.

What is real here

When you step through, the page runs X25519 (RFC 7748) and ML-KEM-768 (FIPS 203) in your browser with the open source libraries @noble/curves 2.4.0 and @noble/post-quantum 0.7.1, with fresh random keys every time. The sizes under "Measured in this run" are counted from the bytes, and the last step compares the two sides' secrets. The timings are measured on your device as it runs. It is not a whole TLS connection: there are no certificates, no transcript and no encryption of data.

Why two exchanges

X25519 is a classical exchange that Shor's algorithm would break on a large enough quantum computer. ML-KEM-768 is NIST's standard for a post-quantum key exchange. RFC 10024 describes the hybrid as meant to provide security as long as at least one of the two parts remains secure. The cost is size: 1,216 and 1,120 bytes where X25519 alone sends 32 each way.

Sizes from the standards

  • X25519 public key, secret and shared secret: 32 bytes each (RFC 7748).
  • ML-KEM-768 encapsulation key 1,184 bytes, decapsulation key 2,400, ciphertext 1,088, shared secret 32 (FIPS 203, Table 3).
  • Client share 1,216 bytes, server share 1,120 bytes, ML-KEM part first in both (RFC 10024).

Try it on your codeThe scanner lists the cryptography a project depends on.