Skip to content

kvn13github/Sophie-Germain-primes-and-safe-primes-in-Python-

Repository files navigation

Sophie-Germain-primes-and-safe-primes-in-Python-

This code generates Sophie Germain primes and safe primes up to 10 digits

bandicam 2023-03-11 12-59-17-066

The second script generates Sophie Germain primes and safe primes up to 4 digits and plots a graph

image

"The key fact that ties primes to the world of IT is that when a number is large, we cannot easily tell whether it is prime or not. This actually means that conducting prime factor decomposition of a large number, especially if its prime factors are also large, is not always easy. As a simplified example, by hand, it takes less than a minute to calculate the product, “m”, of two large prime numbers, “p” = 2017 and “q” = 509 (2017 × 509 = 1026653). However, it is far more difficult to reverse this calculation. That is, given the number 1026653, we need to expend many more resources to find its prime factors, because we essentially need to try dividing 1026653 by all the primes preceding 509.

Many of the major crypto-systems (systems that manage your passwords) rely on this property of primes."

Source: https://sitn.hms.harvard.edu/flash/2017/2-x-prime-1-200-year-old-story-sophie-germain-21st-century-legacy/

https://en.wikipedia.org/wiki/Safe_and_Sophie_Germain_primes

https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange

Code made with ChatGTP