1

I'm writing a cryptography essay, and am wondering why you need a prime number for the Diffie-Hellman key exchange? Any help would be appreciated :)

This is a link to a previous post which quickly shows what the Diffie-Hellman key exchange is: Why/How does the Diffie-Hellman Key Exchange work?

I haven't done modular arithmetic for a while, but I'm sure it will be a simple answer if someone is familiar with it/done it recently!

Gonçalo
  • 15,869
  • Gosh, have you even tried an example where the modulus is not prime? Let the modulus be 45, 64, or 300. If you are uncomfortable with modular arithmetic then you need to buckle down and relearn it, because that is essential to making any sense of Diffie-Hellman. – KCd Apr 20 '13 at 12:20

3 Answers3

2

The D-H encryption schema is one of the Discrete Log based systems.

Contrast this with the Integer Factorization Problem (IFP), like Rivest-Shamir-Adelman (RSA) or Elliptic Curve Discrete Log (ECDLP) based problems.

If you don't use primes, the systems relying on them will be severly reduced in bit-strength (makes it easier to break or potentially does not work at all).

Have fun!

Amzoti
  • 56,629
0

In fact you need two primes p and q

Then you can use arithmetic modulo pq to encrypt messages.

The one that knows the prime numbers can calculate things quickly mod pq

but because it is difficult to factor a number into primes, people who know the product and not the factors will not be able to calculate things so quickly mod pq.

That's how it is used for encryption.

shobon
  • 775
0

In the Diffie-Hellman key exchange, you want that the secret $g^{a \cdot b}$, Alice and Bob agree on, have many possible outcomes (otherwise, an attacker could brute-force all possible outcomes).

The number of elements of a group is given by its \emph{order}. In the case of the multiplicative group over integers modulo $p$ (which original Diffie-Hellman use), the order is given by Euler's totient function $\phi(p)$ and if $p$ is a prime number, we have $\phi(p)=p-1$. So, if $p$ is chosen as a large prime number, we have $p-1$ many possible outcomes.

Regards