Subject Cryptography Chapter is about DiffieHellman Alice an
Subject Cryptography Chapter is about Diffie-Hellman
Alice and Bob wish to agree on a 256-bit AES key. They are trying to decide between using 256-bit, 512-bit, or some other length DH public keys gx and gy. What would be your recommendation to them?
Solution
Assuming that \"p\" is a prime number and \"g\" is a primitive root of \"p\".
Bob could generate a secret value x and find (gx mod p), call this value as A. This A will be sent to Alice.
Similarly Alice could generate a secret value y and find (gy mod p), call this value as B. This B will be sent to Bob.
Now, Alice will calculate (Ay mod p) and Bob will calculate (Bx mod p).
If we clearly see [(gx mod p)y mod p] and [(gy mod p)x mod p] are same as (Ay mod p) and (Bx mod p) respectively and also both will generate a same result.
This algorithm of sharing a secret key will be very strong for larger P values. Larger the value of P the larger will be the value of gx and gy. Thus, for higher security it is always recommended to got with 512 bit keys.
