Cryptography & Key Sizing formula solvers

Average Brute-Force Time

t=2H1Rt = \frac{2^{\,H-1}}{R}

Cryptography & Key SizingExpected time for an exhaustive search over a space of 2^H values at R guesses per second. The average is half the space, hence the H − 1. It assumes an OFFLINE attack on a fast hash with no rate limiting — the worst realistic case, and the only one worth sizing against.

Birthday Collision Probability (Exponential Approximation)

p1en2/(2N)p \approx 1 - e^{-n^{2}/(2N)}

Cryptography & Key SizingChance that n values drawn independently from a space of N contain at least one repeat. This is the exponential APPROXIMATION, and it exists because the exact all-distinct product cannot be evaluated at the sizes cryptography works in: N = 2^128 would need 2^64 factors. It is excellent when n is far below N and it overstates the collision chance when n is a large fraction of N.

Elliptic Curve Security Strength

s=n2s = \frac{n}{2}

Cryptography & Key SizingClassical security strength of an elliptic curve group whose order is about n bits: half the key size, because the best known generic attack is Pollard's rho, which finishes in about the square root of the group order. P-256 gives 128 bits, P-384 gives 192, P-521 gives about 260.

Hash Collision Resistance (Birthday Bound)

n1/22ln2    2b/2n_{1/2} \approx \sqrt{2\ln 2}\;\cdot\;2^{\,b/2}

Cryptography & Key SizingNumber of messages that must be hashed before a collision becomes as likely as not, for a hash with a b-bit output. It is about 2^(b/2), and the constant sqrt(2 ln 2) = 1.1774 is the exact leading factor. NIST SP 800-107 Rev. 1 uses this to state that an approved hash function of b bits provides b/2 bits of collision resistance.

Key Space Size

N=bLN = b^{L}

Cryptography & Key SizingHow many distinct values exist when each of L positions can independently hold any of b symbols. A four-digit PIN is 10^4 = 10,000; a twelve-character password over the 95 printable ASCII characters is 95^12, about 5.4 × 10^23. This is a count of possibilities and nothing more — it is an upper bound on the work an exhaustive search needs, never an estimate of the work a real attack needs.

Key Stretching Work Factor

Δs=log2niter\Delta s = \log_2 n_{\mathrm{iter}}

Cryptography & Key SizingBits of extra strength bought by making each guess expensive. Running a password through n iterations of a key derivation function multiplies an attacker's cost by n, which is log2(n) bits. The cost PARAMETER of bcrypt, scrypt and Argon2 is this number directly — a bcrypt cost of 12 means 2^12 = 4096 iterations and 12 added bits.

Passphrase Entropy (Diceware and Word Lists)

H=wlog2DH = w\log_2 D

Cryptography & Key SizingEntropy in bits of a passphrase built by drawing w words uniformly at random from a list of D. Diceware's standard list holds 7776 words — 6^5, one word per roll of five dice — so each word contributes exactly log2(7776) = 12.925 bits. The dice matter: rolling them is what makes the draw uniform, and choosing words that 'feel random' is not the same operation.

Password Entropy (Uniform Random Generation)

H=Llog2bH = L\log_2 b

Cryptography & Key SizingEntropy in bits of a password GENERATED by picking L symbols uniformly at random from an alphabet of b. This page takes a length and an alphabet size and has nowhere to type a password, on purpose: entropy describes how a secret was produced, not what it looks like, so no calculation on the characters of a human-chosen password can recover it.

Reed-Solomon Correctable Errors

t=nk2t = \left\lfloor \frac{n - k}{2} \right\rfloor

Cryptography & Key SizingSymbol errors a Reed-Solomon code RS(n, k) can correct: half the parity symbols, rounded down. Reed and Solomon's 1960 construction meets the Singleton bound exactly, so the n − k parity symbols do the most any code of that size could — they correct t errors at unknown positions, or twice as many erasures at known ones.

Truncated Hash Strength

scoll=b2spre=bs_{\mathrm{coll}} = \frac{b}{2} \qquad s_{\mathrm{pre}} = b

Cryptography & Key SizingSecurity a hash retains when its output is truncated to b bits, following NIST SP 800-107 Rev. 1: collision resistance falls to b/2 bits while preimage resistance stays at the full b. Truncation is permitted and normal — take the leftmost bits — but the two resistances shrink at different rates, and confusing them is how a digest ends up too short.

Unicity Distance

U=H(K)DU = \frac{H(K)}{D}

Cryptography & Key SizingShannon's 1949 figure for how much ciphertext a cryptanalyst needs before exactly one key remains consistent with it: the entropy of the key divided by the redundancy of the plaintext language. Below the unicity distance, several keys produce sensible-looking plaintexts and the message is genuinely ambiguous. It is a theoretical bound on INFORMATION available, not a statement about the work of finding the key.