← Cryptography

🤝 ECDH

Compute a shared secret with X25519, P-256 or secp256k1.

How it works

Each side multiplies its own private key by the other side’s public key; both land on the same point, and its x-coordinate is the shared secret. Use the raw secret only as input to a KDF such as HKDF, never directly as a key. For the NIST curves and secp256k1 the secret is the 32/48-byte x-coordinate (what WebCrypto and OpenSSL return).