Avalanche Effect Target
A good hash flips about half its output bits when one input bit changes.
Live Calculator
MembersVariables
Example
256-bit hash: ~128 bits should flip per input change
How it works
This formula gives the ideal avalanche target for a hash function: if you change one input bit, each output bit should have about a 50% chance of flipping. That means the expected number of changed output bits is half the hash length, because the output bits behave like independent coin flips in a well-designed construction. The target comes from the idea that a secure hash should make small input changes produce outputs that are statistically indistinguishable from random with respect to the old output.
When to use it
Use this when evaluating or teaching hash-function diffusion, comparing two candidate hashes, or checking whether a design has enough sensitivity to input changes. It is also useful in cryptographic testing, where you measure whether observed bit-flip counts are close to the ideal half-output-length benchmark.
Worked example, step by step
Suppose a hash produces a 512-bit output. E[Δ] = n/2 E[Δ] = 512/2 E[Δ] = 256 So, on average, changing one input bit should flip about 256 output bits.
Common mistakes to avoid
- Thinking the formula says exactly half the bits must flip every time, instead of on average
- Using the number of input bits instead of the output size n
- Assuming a poor hash is acceptable just because some output bits change
Did You Know?
The avalanche effect is why changing a single comma in a document utterly transforms its SHA-256 fingerprint.
Share this formula
More in Cryptography & Security
View allModular Exponentiation
IntermediateCore operation of RSA encryption — raise a message to a power, modulo n.
RSA Decryption
AdvancedRecovers the message using the private exponent d.
Euler's Totient
IntermediateCounts integers below n coprime to it, for n = pq — used to make RSA keys.
Shannon Entropy
AdvancedAverage information content — and the theoretical strength of a random source.
Password Entropy
IntermediateBits of security from password length and character-set size.
Key Space Size
IntermediateNumber of possible keys for a b-bit key.