RSA Fixed-Point Leakage (Unconcealed Messages) → Factorization
- •
What it is
- •
For any RSA key, there are always exactly "unconcealed" messages for which encryption does nothing: (harmless in practice, since real messages essentially never happen to be one of these by chance). But observing that a known message failed to be concealed leaks real information: the order of modulo divides . Writing ( odd) and repeatedly squaring , the sequence must hit eventually (Fermat) — and the value just before it first hits 1 is, with good probability, a non-trivial square root of unity modulo N: some with . Such a value can only exist because is composite (a prime modulus has only as square roots of unity), and then reveals a non-trivial factor directly — the same core idea that powers the Miller-Rabin primality test's ability to catch composite numbers.
- •
- •
When to apply
- •
An RSA encryption function explicitly reveals (or you can detect) that a specific known plaintext happened to encrypt to itself — — even without ever seeing or .
- •
- •
Math
- •
order. Write , odd. Compute , then . The first index where is some value other than but squares to 1 gives as a non-trivial factor (if the sequence instead hits before ever showing a non-trivial root, that particular witness is a dead end).
- •
- •
Worked example
- •
Toy RSA with () and (chosen so unconcealed messages of high order are plentiful): constructing as a CRT-combination of a non-trivial 16th-root-of-unity mod and mod confirmed exactly, then repeatedly squaring and computing found a genuine, non-trivial factor of on the first iteration where .
- •
- •
Python
- •
from math import gcd x = m for _ in range(20): # more than enough for e-1's 2-adic valuation x = pow(x, 2, N) g = gcd(x - 1, N) if 1 < g < N: p, q = g, N // g break
- •
- •
Related
- •
Cards
- •
What does it mean for a message to be "unconcealed" by RSA encryption?
- •
m^e ≡ m (mod N) — encrypting it returns the exact same value, so its multiplicative order divides e-1.
- •
- •
Why does finding a non-trivial square root of unity mod N reveal a factor of N?
- •
A prime modulus only has ±1 as square roots of unity; a composite N having another one means gcd(x-1, N) splits off a genuine, non-trivial factor.
- •
- •