# Thread: Modular arithmetic and cryptography

1. ## Modular arithmetic and cryptography

Why we need to use modular arithmetic in cryptography like Diffie hellman and RSA problm?

2. Originally Posted by jsridhar72
Why we need to use modular arithmetic in cryptography like Diffie hellman and RSA problm?
Informally, people generally use modular arithmetic in cryptography because it creates a scenario in which one way is solvable in polynomial time (this is the stuff that the two people who are sharing information have to do) and the other way is generally thought to be intractable (this is the stuff that anyone who wants to steal the information has to do). So, modular arithmetic makes it so it's easy enough to communicate information but super hard to steal the information from the outside. The reason for this is, usually, breaking a code that uses modular arithmetic requires being able to factor large numbers in order to find primitive roots or multiplicative inverses, and there is no polynomial time algorithm for factoring.

there's a decent explanation of Diffie Hellman on wikipedia, too, if you want some more information on what exactly is going on.

3. ## Thank you

Originally Posted by culturalreference
Informally, people generally use modular arithmetic in cryptography because it creates a scenario in which one way is solvable in polynomial time (this is the stuff that the two people who are sharing information have to do) and the other way is generally thought to be intractable (this is the stuff that anyone who wants to steal the information has to do). So, modular arithmetic makes it so it's easy enough to communicate information but super hard to steal the information from the outside. The reason for this is, usually, breaking a code that uses modular arithmetic requires being able to factor large numbers in order to find primitive roots or multiplicative inverses, and there is no polynomial time algorithm for factoring.

there's a decent explanation of Diffie Hellman on wikipedia, too, if you want some more information on what exactly is going on.

Thanks friend. So as my Professorr said mod provide the security of crypto systems. I saw in some books that because mod arithmetic is easy to with in computers, and to avoid integer division errors people use it. But it seems more than that since it provide one way function so that it is use. Thanky you once again