Number of bits and security level

How many bits and digits a number has, the rule 2^k = 10^(0.301 k), and what key sizes like 2^128 or RSA-2048 mean.

How it works

A whole number $x \ge 1$ has $b = \lfloor \log_2 x \rfloor + 1$ bits and $d = \lfloor \log_{10} x \rfloor + 1$ decimal digits. The two are linked by $\log_{10} x = \log_2 x \cdot \log_{10} 2$ with $\log_{10} 2 \approx 0.30103$, so $2^k \approx 10^{0.301 k}$: 10 bits are about 3 digits ($2^{10} = 1024$), and a 2048-bit RSA modulus has 617 digits.

Cryptographers measure strength in bits: a scheme has $k$-bit security when the best known attack needs about $2^k$ operations. Every extra bit doubles the work. A 56-bit DES key was found by brute force in 1998; $2^{128}$ keys, the size of AES-128, would take a billion computers each trying a billion keys per second about $10^{13}$ years, a thousand times the age of the universe.

Key length and security level are not the same thing. For AES the security is the key length, but for RSA the best attacks factor the modulus much faster than by trying, so RSA-2048 gives about 112-bit security and RSA-3072 about 128 bits; elliptic curves need about twice the security level in key size (256-bit curves for 128-bit security), and a 256-bit hash gives 128-bit security against collisions because of the birthday paradox.

Everything is calculated in your browser. Nothing you type leaves your device.