Rainbow tables as a solution to large prime factoring

From one of my favorite books ever, Applied Cryptography by Bruce Schneier “If someone created a database of all primes, won’t he be able to use that database to break public-key algorithms? Yes, but he can’t do it. If you could store one gigabyte of information on a drive weighing one gram, then a list … Read more

How many prime numbers are there (available for RSA encryption)?

RSA doesn’t pick from a list of known primes: it generates a new very large number, then applies an algorithm to find a nearby number that is almost certainly prime. See this useful description of large prime generation): The standard way to generate big prime numbers is to take a preselected random number of the … Read more

Fast prime factorization module

If you don’t want to reinvent the wheel, use the library sympy pip install sympy Use the function sympy.ntheory.factorint Given a positive integer n, factorint(n) returns a dict containing the prime factors of n as keys and their respective multiplicities as values. For example: Example: >>> from sympy.ntheory import factorint >>> factorint(10**20+1) {73: 1, 5964848081: … Read more