Review and sign transactions from a single secure screen with Ledger Flex™

Discover now

Up your Web3 game

Ledger Academy Quests

  • Test your knowledge
  • Earn POK NFTs
Play now See all quests

Birthday Attack

Jun 19, 2025 | Updated Jun 19, 2025
A birthday attack is a collision attack targeting systems that rely on hash functions, such as digital signatures and password storage.

What Is a Birthday Attack?

A birthday attack is a type of brute-force cryptographic attack. It heavily relies on the probability of finding collisions between random attack attempts and a given set of combinations.

This attack exploits the mathematics behind the birthday paradox (birthday problem) in probability theory. This paradox states that at least two people in a group of 23 individuals have a 50% chance of sharing the same birthday. The likelihood typically increases as the number of people in the group increases. While this seems unlikely given 365 possible birthdays, the mathematical reality demonstrates how collision probabilities increase much faster than intuition suggests.

In cryptographic terms, this principle applies to hash functions, where attackers seek to find two different inputs (messages, files, or data) that produce identical hash values. Rather than needing to test all possible combinations, the birthday paradox shows that collisions become probable with far fewer attempts than the hash function’s full output space would imply.

This mathematical relationship means that for a hash function producing n-bit outputs, attackers typically need only about 2^(n/2) attempts to find a collision, rather than the 2^n attempts that might be expected. For example, while a 128-bit hash has 2^128 possible outputs, birthday attacks could find collisions in approximately 2^64 attempts.

How Does It Work?

In a birthday attack, the perpetrator attempts to find a collision – that is, find two distinct input values that generate the same hash value – in a system that leverages hash functions to validate data integrity. 

First, the attacker selects a hash function they intend to target. Next, they generate random inputs or variants of two different inputs by making minor tweaks, such as adding punctuation or whitespaces. They then compute their corresponding hash values based on the selected hash function. 

Successfully finding a collision allows the attacker to fool a cryptographic system into accepting two separate pieces of data (such as transactions or contracts) as being identical. Due to the birthday problem, the probability of finding a hash collision increases as the attacker generates more input values.

Finding a collision potentially allows the attacker to substitute legitimate data with fraudulent versions while retaining the hash value. For instance, the bad actor could create fraudulent digital signatures matching genuine data or crack a password hash. As a result, the attacker could modify a transaction, duplicate a contract, or even exploit other data within the system undetected.

Generally speaking, this attack can be mitigated by leveraging strong hash functions that make collisions computationally infeasible. Using salts in hash functions also protects against birthday attacks, ensuring that even identical input values always produce distinct hash values.

Relay Chain

The relay chain acts as the central chain of data in the Polkadot network, a protocol that allows interoperability between different blockchain networks.

Full definition

Pegged

The term “pegged” describes an asset whose value is attached to the value of another. It is designed to maintain a specific ratio to the designated asset.

Full definition

Total Supply

The total supply of a cryptocurrency measures how many of the currency’s coins/tokens are currently in existence.

Full definition

Own your crypto future

Stay informed with security tips, updates, and exclusive offers from Ledger

Your email address will only be used to send you our newsletter, as well as updates and offers. You can unsubscribe at any time. Learn more

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.