What is the birthday paradox?

Birthday Paradox

Birthday paradox refers to no less than 23 people in at least two of the same birthday probability greater than 50%. For example, in a 30-person primary school classes, there are two birthdays the same probability of 70%. For large classes of 60 people, the probability is greater than 99%. From the perspective of cause logical contradiction, the birthday paradox is not a "paradox." But this mathematical fact is very counter-intuitive, it is called a paradox. Birthday paradox mathematical theory is applied to design cryptographic attack - the birthday attack.

explain

23 provided a human individual in one day to 365 days optionally 365/365, the second person can not be selected from the first birthdays of 364/365, a third person can not be selected for the two birthdays 363/365:

/// @file main.cc
#include <cstdio>

int main()
{
	double ans = 1.0;
	int n = 23;
	for (int i = 0; i < n; ++i )
		ans = ans*(365-i)/365;
	printf("%.10lf\n",1.0 - ans);  
	return 0;
}

Final output results are as follows:

:g++ main.cc -o main
:./main
0.5072972343

The n to 99, the result is:

:./main
0.9941226609
application

Birthday paradox commonly applied to the detection of a hash function: N-bit length of the hash table collision may occur is not the number of tests 2 N times but only 2 N / 2 times. This conclusion is applied to crack the password hash functions (cryptographic hash function) of the "birthday attack" in.

Birthday attack is a cryptographic attacks, such attacks can be used to abuse of communication between two or more groups. This attack relies on a random attack in a high probability of collision and fixed displacement frequency (the pigeonhole principle). Use birthday attack, an attacker can find a collision in the hash function, the original resistance as security.

Published 127 original articles · won praise 5 · views 20000 +

Guess you like

Origin blog.csdn.net/LU_ZHAO/article/details/104839332