Our toy example uses:
p = 11 # 4 bits
q = 13 # 4 bits
n = 143 # 8 bitsThis lets us see the mathematics. Real RSA uses the same broad construction with enormously larger integers and additional implementation safeguards.
FAQ: RSA-2048#
Here’s are the FQA for RSA-2048.
It provides additional insight about how our RSA-8 works.
What does RSA-2048 mean?#
The quoted RSA size refers to the modulus n.
Conceptually:
p ~ 1024-bit prime
q ~ 1024-bit prime
|
v
n = p * q
|
v
n ~ 2048 bitsA 2048-bit integer can require about 617 decimal digits.
Why should p and q have comparable sizes?#
Consider another toy example:
p = 211 # 8 bits
q = 17 # 5 bits
n = 3587 # 12 bitsThis is mathematically usable for a demonstration, but one factor is small. An attacker trying small factors quickly discovers:
3587 / 17 = 211Compare a more balanced toy pair:
p = 59 # 6 bits
q = 61 # 6 bits
n = 3599 # 12 bitsThe lesson is not that p and q must be numerically almost equal. Rather, real RSA key generation aims for appropriately large primes with comparable bit lengths and follows specific generation requirements.
A bad conceptual design would be:
p = very large prime
q = unusually small primeEven if their product has the desired overall bit length, the small factor undermines the intended security.
Does q have to be larger than p?#
No.
These are equivalent for our purposes:
p = 11, q = 13and:
p = 13, q = 11Both give:
n = 143
phi(n) = 120Ordering is merely a convention.
Can p and q be the same?#
Normal RSA key generation requires distinct prime factors.
Do not deliberately choose: p = q
For example:
p = 17
q = 17
n = 289 = 17^2The modulus has an immediately obvious square-root factorization. Also, the familiar formula for distinct primes,
phi(n) = (p - 1)(q - 1)does not apply in the same form when p = q.
RSA-8 Vs RSA-2048#
| Property | Toy RSA | RSA-2048 concept |
|---|---|---|
| Modulus | 143 | about 2048 bits |
| Modulus size | 8 bits | 2048 bits |
| Prime sizes | 4 bits | ~ 1024 bits |
| Factoring | trivial | intended to be computationally infeasible |
| Purpose | education | real cryptographic use when correctly implemented |
Modern factoring is more sophisticated than trying every integer one at a time.
Algorithms such as the General Number Field Sieve are used against large integers. RSA parameters are therefore selected based on established cryptographic standards, not on the difficulty of simple trial division alone.
🔑 Key Takeaway#
The mathematics of our tiny key and RSA-2048 follows the same core story:
Generate p and q
|
v
n = p * q
|
+----> public modulus
|
v
derive RSA private informationWhat changes dramatically is the computational difficulty of reversing:
n ---> p and qThat one-way difficulty is the intuition our 8-bit experiment is designed to make memorable.


