Documentation ¶
Overview ¶
Copyright 2024 The Bombus Authors
Use of this source code is governed by a MIT style license that can be found in the LICENSE file.
Package dh Diffie–Hellman key exchange ***********************************************************
* * Diffie–Hellman key exchange * * 1. Alice and Bob agree to use a prime number p = 23 and base g = 5. * * 2. Alice chooses a secret integer a = 6, then sends Bob A = g^a mod p * A = 5^6 mod 23 * A = 15,625 mod 23 * A = 8 * * 3. Bob chooses a secret integer b = 15, then sends Alice B = g^b mod p * B = 5^15 mod 23 * B = 30,517,578,125 mod 23 * B = 19 * * 4. Alice computes s = B^a mod p * s = 19^6 mod 23 * s = 47,045,881 mod 23 * s = 2 * * 5. Bob computes s = A^b mod p * s = 8^15 mod 23 * s = 35,184,372,088,832 mod 23 * s = 2 * * 6. Alice and Bob now share a secret (the number 2) because 6 × 15 is the same as 15 × 6
*
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.