37 lines
854 B
Plaintext
37 lines
854 B
Plaintext
= Diffie Hellman =
|
|
|
|
Diffie Helman is a secret sharing algorithm where a shared secret can be
|
|
created between two parties via an unsecure channel.
|
|
|
|
* Diffie hellman is not for encryption
|
|
* used to generate private key
|
|
|
|
== algorithm ==
|
|
|
|
1) For some prime `q`
|
|
2) Select some `alpha` such that `alpha < q` and `alpha` is a
|
|
[[../math/primative_root|Primative root]] of `q`
|
|
* known as global elements
|
|
3) X,,a,, and X,,b,, are the private keys of alice and bob respectively
|
|
* known as private elements/keys
|
|
4) Y,,a,, is `alpha^x,,a,, mod q`
|
|
* Same for Y,,b,,
|
|
* Known as public elements/keys
|
|
5) Both parties then calculate the shared secret via
|
|
`K,,a,, = Y,,b,,^X,,a,, mod q`
|
|
* same for K,,b,,
|
|
* K,,a,, should be same as K,,b,,
|
|
|
|
== example ==
|
|
|
|
```
|
|
q = 7
|
|
alpha = 5
|
|
|
|
X,,a,, = 3
|
|
Y,,a,, = 5^3 mod 7 = 6
|
|
|
|
X,,b,, = 4
|
|
Y,,b,, = 5^4 mod 7 = 2
|
|
```
|