TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Benchmarking RSA Key Generation

49 pointsby mfrw5 months ago

3 comments

jdewerd5 months ago
&gt; The prime-counting function approximation tells us there are Li(x) primes less than x, which works out[5] to one prime every 354 odd integers of 1024 bits.<p>Rule of thumb: Want a 1024-bit prime? Try 1024 1024-bit candidates and you&#x27;ll probably find one. Want a 4096-bit prime? Try 4096 4096-bit candidates and you&#x27;ll probably find one.<p>The approximate spacing of primes around p is ln(p), so ln(2^1024) = 1024*ln(2), and ln(2)=0.693 so if you are willing to absorb 0.693 into your rule of thumb as a safety margin you get the delightfully simple rule of thumb above. Of course, you&#x27;ll still want to use a sieve to quickly reject numbers divisible by 2, 3, 5, 7, etc, and this easily rejects 90% of numbers, and then do a Fermat primality test on the remainders (which if you squint is sort of like &quot;try RSA, see if it works&quot;), and then do Miller-Rabin test to really smash down the probability that your candidate isn&#x27;t prime. The probabilities can be made absurdly small, but it still feels a bit scandalous that the whole thing is probabilistic.<p>EDIT: updated rule of thumb to reflect random candidate choice rather than sequential candidate choice.
评论 #42586671 未加载
评论 #42587515 未加载
评论 #42587334 未加载
JacobiX5 months ago
It is fascinating (to me at least) that almost all RSA implementations rely on a probabilistic primality test, even though the probability of picking a pseudoprime is extremely small.
评论 #42587583 未加载
throw0101c5 months ago
For new deployments&#x2F;protocols, is there any reason to use RSA? Is RSA (mostly?) about legacy support nowadays?
评论 #42586239 未加载
评论 #42589874 未加载
评论 #42590003 未加载
评论 #42589574 未加载
评论 #42590203 未加载