Skip to main content
1 of 2
M3RS
  • 143
  • 4

Diffie-Hellman key exchange - why is modulo operation necessary?

Could someone explain why it's necessary to have the modulo operation in the Diffie-Hellman key exchange?

Let's imagine we do DH without the modulo operation (A = g^a, B = g^b). Would that not work, because the logarithm (a = log_g(A)) is easy to calculate? And why does the modulo operation have to be done with a prime?

I know it's a basic question, sorry. I understand the protocol, but not the maths around what is easy to calculate and what isn't. I guess we need A = g^a mod p instead of just plain A = g^a, because log_g(A) mod p is very hard to calculate... would it be easy to calculate it without the mod p?

Many thanks in advance.

Andras
  • 143
  • 4