📏 Why 77 to 925 digits? How big is big enough
Overview · Belongs to 1. The mathematics and its section 7, key sizes
The examples in this series use numbers like 23, 2773 and a curve modulo 17, small enough to check by hand. Part 1 says that real systems use the same formulas with numbers of 77 to 925 digits. This page explains where exactly those two numbers come from, and why they are this size: not smaller (then they could be broken) and not bigger (then everything gets slow for nothing).
1. Bits and digits
Cryptographers count in bits (binary digits); this series counts in decimal digits. The conversion: a number of $b$ bits has about $b \cdot \log_{10} 2 \approx 0.301 b$ decimal digits. Precisely:
$$\text{digits} = \lfloor b \cdot \log_{10} 2 \rfloor + 1$$| bits | digits | where you meet it |
|---|---|---|
| 128 | 39 | an AES-128 key |
| 255 | 77 | the prime $2^{255} - 19$ of Curve25519 |
| 256 | 78 | an AES-256 key, a SHA-256 hash |
| 1536 | 463 | each of the two primes of an RSA-3072 key |
| 2048 | 617 | an RSA-2048 key (still the most common) |
| 3072 | 925 | an RSA-3072 key, as recommended for 128-bit security |
| 4096 | 1234 | an RSA-4096 key |
So the two numbers in part 1 are the two ends of what is in use today:
- 77 digits: the field prime of Curve25519, $2^{255} - 19 = 57896044618658097711785492504343953926634992332820282019728792003956564819949$. Every X25519 key exchange and every Ed25519 signature (SSH, TLS, Signal, WireGuard) calculates modulo this number.
- 925 digits: the modulus $n = p \cdot q$ of an RSA key of 3072 bits, the size that gives the same security as Curve25519.
Check it yourself:
python3 -c "print(len(str(2**255 - 19)))" # 77
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:3072 2>/dev/null \
| openssl rsa -noout -modulus | cut -d= -f2 \
| python3 -c "print(len(str(int(input(), 16))))" # 925
2. The goal: 128-bit security
“128-bit security” means: the best known attack needs about $2^{128}$ steps. How much is that?
$$2^{128} \approx 3.4 \times 10^{38}$$Suppose an attacker has the fastest supercomputer of today, about $10^{18}$ operations per second (an “exascale” machine), and every operation is one complete attempt (very generous):
| security | attempts | at $10^{9}$ per second (one fast PC core) | at $10^{18}$ per second (a supercomputer) |
|---|---|---|---|
| 56 bits (old DES) | $7 \times 10^{16}$ | 2.3 years | 0.07 seconds |
| 64 bits | $1.8 \times 10^{19}$ | 585 years | 18 seconds |
| 80 bits | $1.2 \times 10^{24}$ | 38 million years | 14 days |
| 112 bits | $5.2 \times 10^{33}$ | $1.6 \times 10^{17}$ years | 165 million years |
| 128 bits | $3.4 \times 10^{38}$ | $1.1 \times 10^{22}$ years | $1.1 \times 10^{13}$ years |
The universe is about $1.4 \times 10^{10}$ years old: 128 bits would take that supercomputer 780 times the age of the universe. Every extra bit doubles the work, so 128 bits is not “a bit more” than 80 bits but 281 trillion times more.
That is why 128 bits is the common target. AES-128 reaches it directly: in practice there is no better attack than trying all $2^{128}$ keys. For public-key cryptography the question is: how big must the numbers be before the best attack needs $2^{128}$ steps? The answer differs per problem, because the best attacks differ.
3. Why RSA needs twelve times more digits than a curve
Elliptic curves: only the square root helps
Against a good elliptic curve, the best known attack is Pollard’s rho (or baby-step giant-step): about $\sqrt n$ steps for a group of $n$ points. To get $2^{128}$ steps you need $n \approx 2^{256}$: a curve of 256 bits, 77 digits. The rule is simple: security = half the size.
RSA and classic Diffie–Hellman: a much better attack exists
For factoring (RSA) and for discrete logarithms modulo a prime (classic Diffie–Hellman), attackers have the number field sieve. It is sub-exponential: doubling the number of digits does not square the work, it only multiplies it by a (large) factor. Roughly, the work for a $b$-bit number grows like
$$\exp\!\left(1.92 \, (\ln N)^{1/3} (\ln \ln N)^{2/3}\right), \qquad N \approx 2^b$$The $\tfrac13$ in the exponent is the whole point: the number grows much more slowly than $\sqrt N = 2^{b/2}$. So to reach $2^{128}$ steps, RSA needs a much bigger number than a curve. NIST’s table (SP 800-57):
| security | RSA / classic DH | digits | elliptic curve | digits | ratio |
|---|---|---|---|---|---|
| 80 bits | 1024 | 309 | 160 | 49 | 6× |
| 112 bits | 2048 | 617 | 224 | 68 | 9× |
| 128 bits | 3072 | 925 | 256 | 77 | 12× |
| 192 bits | 7680 | 2312 | 384 | 116 | 20× |
| 256 bits | 15360 | 4624 | 512 | 155 | 30× |
The ratio keeps growing: the higher the security you want, the worse RSA gets compared to curves. That is the main reason why modern protocols moved to Curve25519.
What has actually been broken
| record | size | year | effort |
|---|---|---|---|
| RSA-250 (factored) | 829 bits, 250 digits | 2020 | about 2,700 CPU-core years |
| discrete logarithm modulo a prime | 795 bits, 240 digits | 2019 | about 3,100 CPU-core years |
| discrete logarithm on an elliptic curve (prime field) | about 112 bits, 34 digits | 2009 | a cluster of 200 PlayStation 3 consoles, months |
Compare: 925 digits for RSA-3072 and 77 digits for Curve25519. Both are far beyond the records, with a big margin.
4. Why not simply use bigger numbers?
Because it costs speed and space, and buys nothing that is needed.
Speed. Measured with openssl speed on my own computer:
| operation | time |
|---|---|
| X25519 key exchange (77 digits) | 0.02 ms |
| Ed25519 signature (77 digits) | 0.02 ms |
| RSA-2048 signature (617 digits) | 0.4 ms |
| RSA-3072 signature (925 digits) | 1.1 ms |
| making a new RSA-3072 key (finding two 463-digit primes) | about 80 ms |
RSA gets about 8 times slower for every doubling of the key size (the multiplications become 4 times as expensive, and the exponent is twice as long). For a server that does thousands of TLS handshakes per second, that matters.
Space. An Ed25519 public key is 32 bytes and a signature 64 bytes. An RSA-3072 public key is 384 bytes and so is each signature. A quantum-safe key exchange (ML-KEM-768) already adds about 2,300 bytes, so every byte saved elsewhere helps.
Margin. 128 bits is already far beyond any conceivable classical computer (section 2). Going to 256 bits protects against nothing extra in practice, except against a quantum computer, and against that, bigger numbers barely help (section 6).
5. Why the small examples still teach the real thing
The formulas don’t care about the size of the numbers. Square-and-multiply, the extended Euclidean algorithm, Fermat’s little theorem, point addition: they work the same with 2 digits as with 925. Python shows it, because its integers have no size limit:
import secrets
p = 2**255 - 19 # the real Curve25519 prime, 77 digits
x = secrets.randbelow(p)
pow(x, p - 1, p) # 1: Fermat's little theorem, on a real-size prime
pow(pow(x, -1, p) * x, 1, p) # 1: the inverse, found in microseconds
What changes with size is only what an attacker can do: with 2773 you factor by trying (trial division); with 925 digits nothing known works.
6. How long will this last, and what about quantum computers?
- Classical computers. NIST allows 112-bit security (RSA-2048) until the end of 2030; after that, 128-bit security (RSA-3072, or a 256-bit curve) is the minimum. Faster computers do not change this picture much: even a computer a million times faster ($2^{20}$) only removes 20 of the 128 bits.
- Quantum computers. Shor’s algorithm factors and solves discrete logarithms in polynomial time: bigger numbers then cost the attacker only a little more. A 2025 estimate (Gidney) puts breaking RSA-2048 at under a million noisy qubits in under a week, and elliptic curves of 256 bits need even fewer qubits. No such machine exists yet, but this is why the key exchange is already moving to ML-KEM (with X25519 alongside it, as a hybrid). There the security does not come from big numbers, but from lattice problems that quantum computers are not known to speed up.
7. Exercises
Exercise 7.1. How many decimal digits does a 4096-bit RSA modulus have? And a 521-bit number (the curve P-521)?
Answer
$\lfloor 4096 \cdot 0.30103 \rfloor + 1 = \lfloor 1233.0 \rfloor + 1 = $ 1234 digits. $\lfloor 521 \cdot 0.30103 \rfloor + 1 = 156 + 1 = $ 157 digits.
Exercise 7.2. An old system uses 64-bit keys. How long does trying them all take at $10^{12}$ attempts per second (a rack of graphics cards)?
Answer
$2^{64} / 10^{12} \approx 1.8 \times 10^{7}$ seconds $\approx$ 7 months; on average half that. That is why 64 bits is long obsolete.
Exercise 7.3. Computers have roughly doubled in speed every two years. If that went on forever, how many years would it take before $2^{128}$ steps costs as much as $2^{80}$ steps costs today?
Answer
The gap is $128 - 80 = 48$ bits, so 48 doublings: 96 years. And then breaking a single key would still take a supercomputer two weeks. In reality chip speed-ups have slowed down a lot, so 128 bits is safe against classical computers for a very long time.
Exercise 7.4. Why is a 256-bit elliptic curve “128-bit secure”, but a 256-bit AES key “256-bit secure”?
Answer
Against AES the best practical attack is trying all keys: $2^{256}$ steps. Against an elliptic curve the best attack (Pollard’s rho) needs only the square root of the group size: $\sqrt{2^{256}} = 2^{128}$ steps. Different problems, different best attacks.
Sources
- NIST SP 800-57 Part 1 Rev. 5, table 2 (comparable strengths); NIST SP 800-131A Rev. 2 (transitions).
- F. Boudot et al., Comparing the difficulty of factorization and discrete logarithm: a 240-digit experiment, CRYPTO 2020; the RSA-250 factorisation announcement, 2020.
- J. W. Bos et al., Solving a 112-bit prime elliptic curve discrete logarithm problem on game consoles using sloppy reduction, 2012 (computation from 2009).
- C. Gidney, How to factor 2048 bit RSA integers with less than a million noisy qubits, 2025.