 The measurement stage involves Alice measuring each photon she receives using some basis from the set formula_3 while Bob chooses from formula_4 where formula_5 is the formula_6 of their key bits (thus discarding them as key bits, as they are no longer secret) the probability they find disagreement and identify the presence of Eve is

formula_7

So to detect an eavesdropper with probability formula_8 Alice and Bob need to compare formula_9 key bits.Quantum key distribution is vulnerable to a man-in-the-middle attack when used without authentication to the same extent as any classical protocol, since no known principle of quantum mechanics can distinguish friend from foe.As in the classical case, Alice and Bob cannot authenticate each other and establish a secure connection without some means of verifying each other's identities (such as an initial shared secret).