↓ Skip to main content

Part 4: The Story of RSA-8

·519 words·3 mins·
Table of Contents
RSA-8 - This article is part of a series.
Part 4: This Article
From 8-bit RSA to RSA-2048.

Our toy example uses:

p = 11       # 4 bits
q = 13       # 4 bits
n = 143      # 8 bits

This 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 bits

A 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 bits

This is mathematically usable for a demonstration, but one factor is small. An attacker trying small factors quickly discovers:

3587 / 17 = 211

Compare a more balanced toy pair:

p = 59    # 6 bits
q = 61    # 6 bits
n = 3599  # 12 bits

The 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 prime

Even 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 = 13

and:

p = 13, q = 11

Both give:

n = 143
phi(n) = 120

Ordering 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^2

The 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
#

PropertyToy RSARSA-2048 concept
Modulus143about 2048 bits
Modulus size8 bits2048 bits
Prime sizes4 bits~ 1024 bits
Factoringtrivialintended to be computationally infeasible
Purposeeducationreal 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 information

What changes dramatically is the computational difficulty of reversing:

n  --->  p and q

That one-way difficulty is the intuition our 8-bit experiment is designed to make memorable.

MySeq
Author
MySeq
myseq.github.io
RSA-8 - This article is part of a series.
Part 4: This Article

Related