0

I mean, there's the two number, p and q for generating the n in the RSA algorithm. I want to generate the two numbers to their multiplication be 1024 bit long.

  • Possible duplicate of [RSA encryption and decryption in Python](https://stackoverflow.com/questions/30056762/rsa-encryption-and-decryption-in-python) – tevemadar Nov 13 '19 at 20:23
  • I don't want to use built-in functions, that's why I'm asking this question this way. – SzegediA Nov 13 '19 at 20:28
  • generating random 512 bit primes is quite hard, not something you implement without looking at books and/or code that is already implemented; lots of math is needed to do it efficiently enough to get anything in a reasonable time – JohanC Nov 13 '19 at 21:28
  • The requirements for good RSA primes are somewhat stricter than this, both individually and as a pair, to avoid known special-case factorization strategies. – harold Nov 13 '19 at 21:48
  • Python is open source. You could check https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/PublicKey/RSA.py (`generate()` at line 499 in particular), https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/Random/random.py and its containing module. – tevemadar Nov 13 '19 at 21:54

0 Answers0