From cca8f4640e781cc9d15b1c17f3b4d103c5bf46dc Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Tue, 30 Jul 2024 01:36:21 +0700 Subject: [PATCH] ecdh --- docs/2023-08-23-real-world-crypto.html | 34 +++++++++++++++++++++++++- posts/2023-08-23-real-world-crypto.md | 14 ++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/2023-08-23-real-world-crypto.html b/docs/2023-08-23-real-world-crypto.html index 7242257..0695c4a 100644 --- a/docs/2023-08-23-real-world-crypto.html +++ b/docs/2023-08-23-real-world-crypto.html @@ -355,7 +355,39 @@
  • Alice and Bob exchange A and B +
  • + +

    Diffie-Hellman is based on group theory.

    +
    +

    Elliptic Curve Diffie-Hellman (ECDH)

    + +
    +

    Instead of prime number, use elliptic curve.

    + diff --git a/posts/2023-08-23-real-world-crypto.md b/posts/2023-08-23-real-world-crypto.md index 39188d0..366514d 100644 --- a/posts/2023-08-23-real-world-crypto.md +++ b/posts/2023-08-23-real-world-crypto.md @@ -188,4 +188,16 @@ public_key then it's over. - Alice generate secret `a` and public `A = g^a mod p`. - Bob generate secret `b` and public `B = g^b mod p`. - Alice and Bob exchange `A` and `B` - - Same secret `A^b mod p == B^a mod p` + - Same secret `A^b mod p == B^a mod p == g^(ab) mod p` + +Diffie-Hellman is based on group theory. + +## Elliptic Curve Diffie-Hellman (ECDH) + +Instead of prime number, use elliptic curve. + +- Alice and Bob agree on elliptic curve `E` and generator `G`. +- Alice generate secret `a` and public `A = [a]G`. +- Bob generate secret `b` and public `B = [b]G`. +- Alice and Bob exchange `A` and `B` + - Same secret `[a]B == [b]A == [ab]G`