Skip to main content

Security Bits Calculator

Statements like "128 bits of security" or "256 bits of security" sound similar, but describe completely different orders of magnitude.

With this calculator, you can compare security strengths and see which number actually lies behind 2^n.

Security Bits Calculator

Choose a security strength and see what amount of work lies behind the bit count – and why hash length and security strength are not the same thing.

Security strength

128 bits of security

2128

≈ 3.40 × 1038

This is the order of magnitude of attempts a generic attack needs. Every additional bit doubles the effort.

Show exact value of 2128 (39 digits)
340,282,366,920,938,463,463,374,607,431,768,211,456

Compare two security strengths

2256 / 2128 = 2128

≈ 3.40 × 1038

256 bits of security does not mean twice as much effort as 128 bits of security, but 2128 times as much.

Hash length ≠ security strength

Ideal hash function with output length
Or NIST values for

Generic expectation for an ideal 256-bit hash function

Hash output
256 bits
Generic preimage security
256 bits ≈ 2256
Generic collision security
128 bits ≈ 2128

This is the generic expectation for an ideal hash function: preimage attacks need roughly 2n attempts, collisions only roughly 2n/2 because of the birthday bound. A real hash function does not automatically reach these values – MD5, for example, has a 128-bit output but is practically broken in terms of collision resistance.

Takeaway: Security strength grows exponentially: every bit doubles the effort. And the collision security of an n-bit hash is generically only n/2 bits.

What Does the Calculator Show?​

A security strength of n bits means that an attack requires roughly 2^n operations. Every additional bit doubles this effort – so the order of magnitude grows exponentially.

That is why 256 bits are not simply twice as secure as 128 bits: the difference is a factor of 2^128.

In addition, the output length of a hash is not the same as its security strength. An ideal hash function with n bits of output generically offers roughly n bits of preimage security, but, because of the birthday paradox, only roughly n/2 bits of collision security. SHA-256 thus ends up with about 128 bits of collision security.

More About Security Strengths​

I explain the orders of magnitude and their practical meaning in the article How Secure Are 128, 256, and 512 Bits?. The two generic security goals are described in What Is Collision Resistance? and What Is Preimage Resistance?.