Questions tagged [prime-numbers]

A prime number is an integer greater than 1 with no divisors other than itself and 1. Primes and prime products play an important role in public key cryptography.

A prime number is an integer greater than 1 with no divisors other than itself and 1. Primes and prime products play an important role in public key cryptography.

401 questions
101
votes
6 answers

How can I generate large prime numbers for RSA?

What is the currently industry-standard algorithm used to generate large prime numbers to be used in RSA encryption? I'm aware that I can find any number of articles on the Internet that explain how the RSA algorithm works to encrypt and decrypt…
Lukman
  • 1,417
  • 2
  • 14
  • 11
83
votes
7 answers

How are primes generated for RSA?

As I understand it, the RSA algorithm is based on finding two large primes (p and q) and multiplying them. The security aspect is based on the fact that it's difficult to factor it back into p and q. Now, since RSA keys are so large (often 1024 bits…
Vilx-
  • 1,247
  • 1
  • 9
  • 14
38
votes
7 answers

Is it feasible to build an index of prime factors?

Would it be possible to break an RSA key, in for example 1 week of time, if the cracker have already spent X number of years building an index of primes by performing every permutation of existing prime keys up to $2^{2048}$? I understand this would…
mjs
  • 483
  • 5
  • 9
32
votes
7 answers

Why does RSA need p and q to be prime numbers?

Despite having read What makes RSA secure by using prime numbers?, I seek clarification because I am still struggling to really grasp the underlying concepts of RSA. Specifically, why can't we choose a non-prime $p$ and $q$? I do understand the key…
sharly
  • 423
  • 1
  • 4
  • 4
31
votes
5 answers

Why are primes important for encryption

Why are primes so important? Why can't we just use a random number? My guess is that it's because finding a random prime require more computing power, than finding a random number. Can anybody confirm this?
KaareZ
  • 437
  • 1
  • 4
  • 5
28
votes
3 answers

Are safe primes $p=2^k \pm s$ with $s$ small less recommandable than others as a discrete log modulus?

I take the definition of safe prime as: a prime $p$ is safe when $(p-1)/2$ is prime. Safe primes of appropriate size are the standard choice for the modulus of cryptosystems related to the discrete logarithm problem, such as Diffie-Hellman. A…
fgrieu
  • 149,326
  • 13
  • 324
  • 622
24
votes
1 answer

In layman's terms, how does Shor's algorithm work?

I've just been reading up on Shor's algorithm, and I find it both fascinating and baffling. I don't understand much about it, other than that it can factor semiprimes in polynomial time. Could someone explain how it works in layman's terms and why…
Polynomial
  • 3,577
  • 4
  • 30
  • 45
24
votes
1 answer

RSA with probable primes

I am a bit of a newbie to RSA encryption, so please be patient. I understand that for a 4096 bit RSA, the numbers p and q should be prime. And to have the best security, the p and q should both be about 2048 bits long. However, we don't have a way…
Jug
  • 343
  • 2
  • 5
21
votes
3 answers

How does one calculate a primitive root for Diffie-Hellman?

In the Diffie-Hellman key exchange, one of the steps involves calculating a primitive root of a prime number $p$. How would one go about doing so, considering that $p$ could be very large? Is there some sort of algorithm or equation?
yydl
  • 709
  • 3
  • 8
  • 15
21
votes
4 answers

Why do we need Euler's totient function $\varphi(N)$ in RSA?

After we calculated $N = p * q$, we calculate $\varphi(N)$ and use it later to determine $e$ (PR) and $d$ (PU). But why? For decryption and encryption, we only use $N$ and don't need $\varphi(N)$. So why can't we find $e$ and $d$ without Euler's…
Rimen
  • 229
  • 1
  • 2
  • 4
19
votes
3 answers

What makes RSA secure by using prime numbers?

I am just learning about the RSA algorithm. Looking at the first two steps: Choose two distinct prime numbers $p$ and $q$. Compute $n = pq$. I have some probably stupid questions: Why do $p$ and $q$ have to be prime numbers? Why couldn't they be…
Joark
  • 303
  • 1
  • 2
  • 4
18
votes
2 answers

Can I select a large random prime using this procedure?

Say I want a random 1024-bit prime $p$. The obviously-correct way to do this is select a random 1024-bit number and test its primality with the usual well-known tests. But suppose instead that I do this: select random odd 1024-bit number $n$ if…
Fixee
  • 4,258
  • 3
  • 26
  • 39
18
votes
3 answers

RSA factorization for special primes $p$ and $q$

I want to factorize the modulus $n = pq$ knowing that $p$ and $q$ are not random, but constructed based on integer numbers $a$ and $b$ as following ($a$ and $b$ are not given): $$p = a^2 + b^2, \qquad q = 2ab + 1$$ I'm looking for an efficient…
Lisbeth
  • 577
  • 3
  • 13
18
votes
4 answers

Is Wiener's attack on RSA extendable to larger keys with low hamming weight?

Using small private exponents with RSA improves performance. However, it has been shown (Wiener, 1990) that if $\log d \leq \frac14 \log N$, the private exponent $d$ can be reconstructed from the public key $(N,e)$. Smart, Inc. uses special private…
SecureFish
18
votes
4 answers

Is it possible to validate a Public Key in RSA?

If I have a 1024-bit number, and someone is telling me that it is in fact a valid RSA public key, is there any way I can quickly validate that it is indeed so (without cracking RSA)? (I suppose I am asking if it's possible to quickly tell if a…
yydl
  • 709
  • 3
  • 8
  • 15
1
2 3
26 27