# Understanding Quantum Key Distribution

I have watched dozens of videos on YouTube talking about Quantum Cryptography and how the BB84 algorithm works. However none of them bothered himself to explain how quantum key exchange process works in detail, that is for the newbies like I am. Thus I still have many questions that I could not find an answer for yet. Given the following scenario where Alice is the sender and Bob is the receiver :

1- How Alice and Bob agree on which of the two beam splitters bases (Horizontal-Vertical and Right-Left) correspond to which of the classical bits (1 and 0) ? How do Alice and Bob agree on when actual transmission starts, when it is time to send/receive a photon taking note of event ?

2- I understood that once Bob has measured all of the photons sent by Alice, he would record the list of the beam splitters bases he used to measure those photons and send this list to Alice to check Bob's bases against hers. If Alice finds a match she would tell Bob to use the received qubit state as part of the key. Otherwise she will tell him to discard it. Right?

3- If the point 2 holds correct, I would like to know how would Alice detect that there was an eavesdropper Eve and warn Bob about that based on Bob's beam splitters bases list ?

4- Where does Heisenberg's uncertainty principle comes into action in QKD ?

I hope to get some detailed answers.

1) How Alice and Bob agree on which of the two beam splitters bases (Horizontal-Vertical and Right-Left) correspond to which of the classical bits (1 and 0) ? How do Alice and Bob agree on when actual transmission starts, when it is time to send/receive a photon taking note of event ?

Alice and Bob operate according to an agreed-upon protocol, which can define what binary value is assigned to what is physically made or observed, perhaps as follows:
Image source: UNS Nice (France), Department of Physics

There remains to agree on conventions in physical orientation, in particular what's rectilinear and what's diagonal (the optical link can rotate things); and the sequencing of sending photons and moving polarizer in-between.

Sequencing can be using an agreed-upon amount of time between photon emission, with the move of polarizer occurring in-between. Both that sequencing and the orientation can be determined by having Alice conventionally sending a repeating pattern before start of transmission, which allows Bob to calibrate it's receiving gear and reach synchronization (in particular rotate polarizer at a moment when that won't prevent photon detection of photons). The start of actual transmission can be determined by an agreed-upon and detectable change in the sequence, e.g. start right after
|/−\||/−\||/−\||/−\||/−\||/−\||/−\||/−\||/−\||/−\||/−\||/−\||/−\|−\|/−
The beginning has period 5 and allows to find what's what. The last 5 photons are rotated compared to the continuation of the sequence, which provides a robust indication of start to Bob having reached synchronization.

2) Once Bob has measured all of the photons sent by Alice, he would record the list of the beam splitters bases he used to measure those photons and send this list to Alice to check Bob's bases against hers. If Alice finds a match she would tell Bob to use the received qubit state as part of the key. Otherwise she will tell him to discard it. Right?

Yes. Note that the transmission of binary information from Bob to Alice, and back, occurs over a classical (non-quantum) public channel which authenticity typically is insured by conventional information-theoretic cryptography using an agreed-upon one-time-use shared key (see section B.3 in that answer) That key can be renewed by sparing a fraction of what's established by a step of Quantum Key Distribution, in order to secure the next one.

3) How would Alice detect that there was an eavesdropper Eve and warn Bob ?

The determination that there was no foul play is made by some highly technical "secret-key reconciliation" and "privacy amplification" protocol (running over classical channels authenticated as in 2 and allowing Bob to positively confirm success to Alice, or/and vice versa). Complex but conventional error-detection and correction techniques are involved. Basically, if the error rate of the quantum channel is sufficiently low, Eve can't have learned enough of it to compromise the confidentiality of the key obtained thru this protocol. See sections B.1 and B.2 of said answer for more.

4) Where does Heisenberg's uncertainty principle comes into action in QKD?

This principle asserts that a photon's polarizations according to diagonal and rectilinear directions can't be both determined by an observer. That prevents Eve from reliably determining the state of Alice's photon and sending an exact copy to Bob: in her attempt at that Eve is bound to make at least 50% error for the polarization she could not observe, that is 25% error overall at the bit level, and that's detectable per the protocol of 3).