# Return to Answer

 3 a good entropy source is always needed edited Nov 10 '18 at 9:19 forest 46.1k1919 gold badges148148 silver badges167167 bronze badges The way random prime generation works is by generating a huge, random odd number of a specific size (e.g. 2048 bits). It is then checked for primality. If it is not prime, it is incremented by two and checked again. This repeats until it is found to be prime. I describe this more in another answer. There is nothing specific that prevents two private keys from being the same, but the probability of that is so astronomically low as to be irrelevant. There's no reason to explicitly try to avoid collisions. Note that this assumes the system has a good source of random numbers. Bugged random number generators or embedded systems with a poor source of randomness may generate RSA moduli who share a prime factor, leading to trivial cryptanalysis by checking for the greatest common denominator between two moduli and then dividing them by the result to obtain both prime factors. The way random prime generation works is by generating a huge, random odd number of a specific size (e.g. 2048 bits). It is then checked for primality. If it is not prime, it is incremented by two and checked again. This repeats until it is found to be prime. I describe this more in another answer. There is nothing specific that prevents two private keys from being the same, but the probability of that is so astronomically low as to be irrelevant. There's no reason to explicitly try to avoid collisions. The way random prime generation works is by generating a huge, random odd number of a specific size (e.g. 2048 bits). It is then checked for primality. If it is not prime, it is incremented by two and checked again. This repeats until it is found to be prime. I describe this more in another answer. There is nothing specific that prevents two private keys from being the same, but the probability of that is so astronomically low as to be irrelevant. There's no reason to explicitly try to avoid collisions. Note that this assumes the system has a good source of random numbers. Bugged random number generators or embedded systems with a poor source of randomness may generate RSA moduli who share a prime factor, leading to trivial cryptanalysis by checking for the greatest common denominator between two moduli and then dividing them by the result to obtain both prime factors. 2 added link to near-dupe edited Nov 10 '18 at 6:12 forest 46.1k1919 gold badges148148 silver badges167167 bronze badges The way random prime generation works is by generating a huge, random odd number of a specific size (e.g. 2048 bits). It is then checked for primality. If it is not prime, it is incremented by two and checked again. This repeats until it is found to be prime. I describe this more in another answer. There is nothing specific that prevents two private keys from being the same, but the probability of that is so astronomically low as to be irrelevant. Because of that, there'sThere's no reason to explicitly try to avoid itcollisions. The way random prime generation works is by generating a huge, random number of a specific size (e.g. 2048 bits). It is then checked for primality. If it is not prime, it is incremented and checked again. This repeats until it is found to be prime. I describe this more in another answer. There is nothing specific that prevents two private keys from being the same, but the probability of that is astronomically low. Because of that, there's no reason to explicitly try to avoid it. The way random prime generation works is by generating a huge, random odd number of a specific size (e.g. 2048 bits). It is then checked for primality. If it is not prime, it is incremented by two and checked again. This repeats until it is found to be prime. I describe this more in another answer. There is nothing specific that prevents two private keys from being the same, but the probability of that is so astronomically low as to be irrelevant. There's no reason to explicitly try to avoid collisions. 1 answered Nov 10 '18 at 6:03 forest 46.1k1919 gold badges148148 silver badges167167 bronze badges The way random prime generation works is by generating a huge, random number of a specific size (e.g. 2048 bits). It is then checked for primality. If it is not prime, it is incremented and checked again. This repeats until it is found to be prime. I describe this more in another answer. There is nothing specific that prevents two private keys from being the same, but the probability of that is astronomically low. Because of that, there's no reason to explicitly try to avoid it.