# why prime numbers are used in cryptography

Prime numbers don't break down into smaller factors, making cracking the code or hash much harder than using, say 12, which breaks down with /2 or /3 or /4 or /6. The prime number 7, is less than 12, but only has the factor of 7, so there are less attack vectors. This is a drastic oversimplification, but hopefully helps a little. This only has 2 possible values, for any x above 1: 4 or 8. Since this is used to generate the shared key in a similar way, you end up with the same two possibilities. In other words, once you know that the base and mod are 2 and 12 (which any computer listening in on the conversation would be able to pick up), you automatically know that the shared secret encryption key can be only one of two possibilities. It only takes two simple operations to determine which decrypts the message. Now let's look at a prime mod:

This has 12 different possibilities, for x>1.

It also has 12 different possible shared keys that can be generated. Thus it requires 6x more computing power to decrypt a message based on this prime modulus, than it would on the mod 12 example. 2^x mod 14 has 4 possibilities. 2^x mod 17 has. you guessed it, 16 possibilities! Aren't primes cool? :) Thus, yes the factorability of the modulus number has everything to do with crackability of the encrypted message. Good question. Most of the above commentators got it mostly correct, but they are each telling one part of the story and not describing other aspects in one post. Here is the more full reasons in one post: For starters as a general rule understand it is public key cryptography that requires quantitative methods and specifically number theory. This is part of a larger picture with using modulo arithmetic and prime numbers as part of this type of math. Although it is not necessary to have an in depth understanding of specific aspects number theory like groups (Abelian) to work with cryptography it does make public key cryptography easier to understand and use.

More on the important details later. If you cannot work with modulo arithmetic that would be my first suggestion to learn. 1. ) Fermat's theorem which states: m ^p-1 - 1 modp and can also be seen with this notation: m^p = m modp which means: fro any prime p and any positive integer m not divisible by p which all results in getting back the same remainder. 2. ) Euler's Totient Function aka phi function: phi(n)which is the number of integers less than n and relatively prime to n. Euler's theorem related to the totient (NOT quotient) m^phin = 1 mod n. Euler's theorem states that there is at least one value of p satisfies the relation --phi(p); but there could be more. In symmetric encryption Diffie Hellman utilizes primes and it plays a role with public key cryptography but this too can seem tricky. there are generally two parts with key exchanges within protocols one part asymmetric and then symmetric key formation/sharing.

That is for a different post. The use of primes for Diffie Hellman is as follows: the whole basis is modulo arithmetic as the earlier example, but it also combines modular exponentiation. Now yes prime factorization can be important for certain applications within number complexity theory but this is not universal. Large primes are not so are and they can be found with relative ease, however, they are more secure due to not being able to factor the product of large primes. As others have mentioned the discrete logarithms serve as one example. I also strongly suggest either Daniel Boneh's or Jonathan Katz's free online Coursera courses in Cryptography.

- Views: 5

why does 0 and 1 have no prime factors

why do we use the decimal system

why do we have a prime minister

why do we have a base 10 number system

why do square numbers have odd factors

why is zero factorial equal to one

why is 57 not a prime number