-6

Everybody knows its hard to factor over 100 digit public key but 250 digits RSA number have already been factored and Wolfram was able to factor a 300 digit number.

Wolfram can Factorize

I tried factorizing public key n=144965985551789672595298753480434206198100243703843869912732139769072770813192027176664780173715597401753521552885189279272665054124083640424760144394629798590902883058370807005114592169348977123961322905036962506399782515793487504942876237605818689905761084423626547637902556832944887103223814087385426838463 using a simple prime factor program but it has encountered an error and it keeps repeating.

import math
i = 0 n=144965985551789672595298753480434206198100243703843869912732139769072770813192027176664780173715597401753521552885189279272665054124083640424760144394629798590902883058370807005114592169348977123961322905036962506399782515793487504942876237605818689905761084423626547637902556832944887103223814087385426838463

    p = math.floor(math.sqrt(n))
    while n % p != 0:
        p -= 1
        i += 1
        q = int(n / p)
        print( p,q)

and heres the results:

Prime Factorization

Next I tried Sieve of Eratosthenes

import time
import math

def sieve(b):
global prime_list
for a in prime_list:
    if (a % prime_list[b] == 0 and a != prime_list[b]):
        prime_list.remove(a)

inp = 144965985551789672595298753480434206198100243703843869912732139769072770813192027176664780173715597401753521552885189279272665054124083640424760144394629798590902883058370807005114592169348977123961322905036962506399782515793487504942876237605818689905761084423626547637902556832944887103223814087385426838463

prime_list = []
i = 2
b = 0 
t = time.time()

while i <= int(inp):
prime_list.append(i)
i += 1
while b < len(prime_list):
sieve(b)
b += 1

print(prime_list)
print("length of list: " + str(len(prime_list)))
print("time took: " + str((time.time()-t)))

That doesn't work either. But, I believe a 300 digit number can be factored. I just don't understand why so many programmers who gave up that easily said it's impossible.

Sieve of Eratosthenes

Makyen
  • 31,849
  • 12
  • 86
  • 121

1 Answers1

2

It is easier to factor a number if the factors are small. Here is a nice big 300 digit number for you:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

It’s pretty obvious what the factors are, right? The prime factors are 2299 5299, and that should be obvious from looking at the number.

So, some numbers are easier to factor than others.

RSA keys are made from two large prime numbers multiplied together, with no small factors. For a 309-digit number, the factors might each be over 150 digits. So if you try to use the sieve of Eratosthenes to factor a large prime number, what will happen is that your program will try to calculate all the primes up to 150 digits, and that is simply too many prime numbers to calculate.

The number of prime numbers with less than 150 digits is:

Evaluation of PrimePi in Wolfram Alpha

About 10147, so your program would take at least that many processor cycles to finish. This number is so large, that if we took all of the computers in the entire world (maybe 1021 or 1022 operations per second), your program would take more than 10117 years to run (again, using all of the computers in the entire world).

I just don't understand why so many programmers who gave up that easily said it's impossible.

It’s because factoring numbers is known to be a very hard problem—the people who give up are giving up because they know what the state of the art algorithms are for factoring large numbers (the General Number Field Sieve) and know that 300 digits is just not feasible without some kind of radical new development in algorithms, computers, or engineering.

Dietrich Epp
  • 205,541
  • 37
  • 345
  • 415
  • 1
    If you look carefully at the number he supplied to Wolfram Alpha you can see that it's only the first 184 digits of his 300 digit number. It just happens to have been an unusually easy number to factor because the second largest prime factor is only 17927803413209. Wolfram cannot do anything with the 300 digit RSA modulus. – President James K. Polk Nov 11 '20 at 22:08