1. Worked problem §
How many independent parity constraints leave a uniform eight-bit string with 32 candidates?
Hint 1
Use the rank of the parity equations.
Worked solution
Three independent constraints: 2^(8−3)=32.
Quantum Cryptography · Chapter 04
How do reconciliation and privacy amplification have different jobs?
Starting point: Chapters 1–3 of this course.
Anchor example: A seven-bit syndrome decoder followed by Toeplitz extraction.
Method: Trace the protocol, calculate an example, and identify the security assumptions.
Watch for: Do not count public leakage twice.
This lesson includes explanations, worked examples, and problems with solutions. Advanced results whose proofs are outside the chapter are identified explicitly.
Alice and Bob usually have correlated rather than identical raw strings. A reconciliation protocol reveals information, such as parity checks, so Bob can correct his errors. Every public bit can also help Eve. A conservative leakage budget counts the information revealed during reconciliation, and verification messages must be included in the security accounting as well. Verification then checks whether the corrected strings agree, often using a randomly chosen universal hash. For a suitable t-bit hash family, the chance that unequal strings collide is bounded by 2⁻ᵗ. The hash seed can be public, but the transcript must be authenticated. Reconciliation success is only correctness: two identical strings can still be entirely known to Eve. Privacy amplification addresses that separate question after the leakage is bounded.
Alice announces the parity of a uniformly random four-bit string. How many candidate strings remain?
Exactly eight satisfy either parity value. The announcement removes one bit of entropy in this example.
Work over the binary field: addition is XOR and multiplication is ordinary bit multiplication. Alice has a column vector x and Bob has \(y=x\oplus e\). For a parity-check matrix H, Alice announces \(s_A=Hx\), Bob computes \(s_B=Hy\), and their difference is \(s_A\oplus s_B=He\). The syndrome depends only on the error pattern, so a decoder can search for a likely e without learning x from scratch.
\[H=\begin{pmatrix}0&0&0&1&1&1&1\\0&1&1&0&0&1&1\\1&0&1&0&1&0&1\end{pmatrix}.\]The seven columns are the nonzero three-bit representations of positions 1 through 7. Under a promise of at most one error, a nonzero syndrome directly identifies its position. Let \(x=1011001\), and suppose Bob's fifth bit is flipped, so \(y=1011101\). Alice's syndrome is 010, Bob's is 111, and their XOR is 101: binary five. Bob flips position five to recover x.
The promise is crucial. Errors in positions one and two produce syndrome \(001\oplus010=011\), which imitates a single error in position three. Blindly applying the one-error decoder then leaves three wrong bits. Reconciliation must be followed by verification; a decoder returning a string is not evidence that the string equals Alice's.
For a uniform n-bit x and a rank-r matrix H, each possible syndrome leaves \(2^{n-r}\) candidates. Thus the syndrome leaks exactly r bits in this special uniform example. Repeating a row does not add an independent linear constraint, but a general entropy bound can conservatively charge the full transcript length. Adaptive protocols must also account for messages that select branches, lengths, and positions when these depend on the data.
Verification uses a newly selected hash from a two-universal family: for any unequal x and y, \(P_F[F(x)=F(y)]\le2^{-t}\) for a t-bit output. The probability is over the independent choice of F after the strings are fixed. A fixed short checksum has no such guarantee against arbitrary chosen differences. The verification hash and seed join the public transcript; the t-bit value can cost up to t additional entropy bits. Authentication protects the messages from substitution and has a different purpose.
Worked derivation. A 1,000-bit block uses a rank-120 syndrome and a 40-bit verification tag. What leakage should a conservative length bound subtract?
Subtract at most 160 bits if the syndrome and tag are the only data-dependent disclosures and the entropy bound was taken before both. Public independent matrix seeds need no extra secret-bit charge merely for their length. Any additional data-dependent transcript must be handled too. If the starting entropy already conditions on the syndrome, subtract only the remaining verification leakage.
Conditional min-entropy captures Eve's optimal guessing probability for a classical string X with quantum side information E: Hmin(X|E)=−log₂ pguess(X|E). A quantum-proof strong extractor converts a source with certified entropy into a shorter key close to uniform even when its independent seed is published. Universal hashing supplies one such construction. For an unsmoothed entropy lower bound k after accounting for the transcript, a conservative leftover-hash choice is ℓ≤k−2 log₂(1/εPA), giving trace-distance error at most εPA. Smoothing can improve the entropy bound but adds its own error contribution. The seed must be independent of the source and adversary before extraction. A deterministic truncation has no comparable general guarantee: Eve might already know exactly the prefix being retained.
If post-transcript min-entropy is at least 600 bits and εPA=2⁻⁴⁰, choose a conservative output length.
Choose at most 600−80=520 bits. This assumes the 600-bit bound already conditions on all relevant public leakage.
For a classical distribution with no side information, the most likely string is Eve's best guess, so \(H_{\min}(X)=-\log_2\max_x P(X=x)\). Let a two-bit variable have probabilities \((1/2,1/4,1/8,1/8)\). Its Shannon entropy is 1.75 bits, but its min-entropy is only one bit. The different answers reflect different operational questions: average description length versus the probability of one successful guess.
For quantum side information, Eve can choose a measurement adapted to the states she holds. If \(\rho_{XE}=\sum_xp_x|x\rangle\langle x|\otimes\rho_E^x\), then
\[p_{\rm guess}(X|E)=\max_{\{M_x\}}\sum_xp_x\operatorname{tr}(M_x\rho_E^x),\quad M_x\ge0,\quad\sum_xM_x=I.\]Define \(H_{\min}(X|E)=-\log_2p_{\rm guess}(X|E)\). Perfectly distinguishable records make the guessing probability one even if X is uniform. Identical records leave only the prior distribution. Privacy amplification must use the conditional quantity; an entropy estimate from a random-looking raw string alone is insufficient.
A binary \(\ell\times n\) Toeplitz matrix is constant along each diagonal and is specified by \(n+\ell-1\) random bits. Uniformly choosing those bits gives a two-universal family. For n=4 and ℓ=2, a particular member is
\[T=\begin{pmatrix}1&0&1&1\\0&1&0&1\end{pmatrix},\qquad T\begin{pmatrix}1\\0\\1\\1\end{pmatrix}=\begin{pmatrix}1\\1\end{pmatrix}\pmod2.\]To see the collision property, set \(d=x\oplus y\ne0\). Hash collision means Td=0. Choose the first nonzero coordinate j of d. Each successive output row contains a new diagonal seed bit multiplying that coordinate. Conditional on the later diagonal bits, those ℓ equations determine ℓ distinct uniform seed bits in triangular order. Exactly a fraction \(2^{-\ell}\) of seeds satisfy all equations. This argument works for each fixed nonzero d, which is precisely the required pairwise collision bound.
The quantum leftover-hash lemma, used here as a stated theorem, turns that family into an extractor. If \(H_{\min}(X|E)\ge k\), F is independent of XE, and K=F(X), the unsmoothed trace-distance bound is
\[T(\rho_{KFE},\tau_K\otimes\rho_{FE})\le\tfrac12\sqrt{2^{\ell-k}}.\]F appears on both sides: the output remains approximately independent even after the seed is published. Choose \(\ell\le k-2\log_2(1/\epsilon_{\rm PA})\) for a conservative bound no larger than \(\epsilon_{\rm PA}/2\), hence certainly below \(\epsilon_{\rm PA}\). The theorem tolerates arbitrary quantum E; the classroom collision proof alone does not prove that quantum statement. Smooth versions replace k by a smooth entropy and add a convention-dependent smoothing contribution.
One concrete matrix multiplication does not demonstrate extraction for a source. The guarantee averages over an independently chosen seed and depends on the certified entropy. Choosing a matrix after inspecting X, or reusing a data-dependent seed without a theorem, invalidates the independence step.
A practical analysis begins with a proven entropy bound for the actual protocol and observed data. It then subtracts leakage and extraction costs, allocates failure probabilities, and records whether authentication consumes previously secret bits. Do not subtract a transcript twice: either condition the entropy on it already or apply a leakage bound explicitly. Keep raw block size, test sample size, retained key length, and emitted pulse count in separate columns. Their units are different. A finite-key calculation must identify a theorem covering the actual source, measurement, sampling, and attack model. The arithmetic below starts from an assumed certified entropy bound; it illustrates bookkeeping only and does not derive that bound from a measured QBER. This distinction prevents a plausible spreadsheet from masquerading as a device security certificate.
Assume 8,000 entropy bits before a transcript costing 1,200 bits, εPA=2⁻⁴⁰, and 128 secret bits consumed for authentication. Find the net expansion.
Post-transcript entropy is at least 6,800. Hash to at most 6,720 bits, then subtract 128 consumed secret bits to obtain 6,592 net new bits.
Suppose a valid analysis gives a lower bound \(k_{\rm pre}\) on the raw string's conditional min-entropy before reconciliation. Let \(\lambda_{\rm EC}\) bound reconciliation leakage, let t be the verification tag length, and use the conservative extraction penalty above. The length calculation is
\[\ell=\left\lfloor k_{\rm pre}-\lambda_{\rm EC}-t-2\log_2(1/\epsilon_{\rm PA})\right\rfloor.\]If ℓ is nonpositive, output abort rather than an empty “successful” key. The expression presumes that the entropy theorem and transcript conditioning match. Net expansion additionally subtracts the pre-shared secret bits consumed by authentication, while the actual output key still has length ℓ. Verification correctness has error at most \(2^{-t}\); authentication and estimation have their own parameters.
For a numerical illustration, assume \(k_{\rm pre}=7500\), \(\lambda_{\rm EC}=1300\), \(t=40\), and \(\epsilon_{\rm PA}=2^{-40}\). Then ℓ=6080. If 128 secret bits are consumed for authentication, net expansion is 5952. This computation is an exact consequence of the assumed budget. It is not a derivation of 7500 entropy bits from a QBER measurement.
List every event or distance bound that enters the proof. A union bound can add failure probabilities for authentication, parameter estimation, and correctness. A triangle inequality can add distances from smoothing and extraction. However, converting a parameter-estimation event probability into a smoothing parameter may introduce a square root or another theorem-specific factor. One cannot take arbitrary formulas from different papers, add their ε symbols, and assume they mean the same thing.
A reviewable ledger should therefore name the theorem supplying the pre-transcript entropy, the systems it conditions on, the smoothing convention, the acceptance conditioning, and each disclosed message. Our executable calculator deliberately takes a certified entropy bound as an input rather than fabricating one from its simulated sample. Its job is to make the arithmetic reproducible and reject impossible lengths; providing that input for a real experiment is the harder security task.
Worked diagnostic. A report begins with \(H_{\min}(X|E,C)\ge6000\), where C already contains a 1,200-bit syndrome. It then subtracts 1,200 again. What is wrong?
The report has charged the same leakage twice. The conditional bound already describes Eve after receiving C. It should subtract only disclosures absent from C, followed by the extraction penalty. The corrected accounting does not mean leakage is free; its cost was included earlier when establishing the 6000-bit bound.
Laboratory task. In the supplied Python module, call key_budget(7500, 1300, 40, 40, 128). The fourth argument is the binary security exponent s, meaning \(\epsilon_{\rm PA}=2^{-s}\). Repeat with a larger leakage budget and explain why every additional disclosed bit removes one output bit under this bound.
These exercises draw on the whole chapter. Attempt each question before opening a hint, explain your reasoning, then compare it with the worked solution.
How many independent parity constraints leave a uniform eight-bit string with 32 candidates?
Use the rank of the parity equations.
Three independent constraints: 2^(8−3)=32.
What verification tag length gives collision probability at most 2⁻⁴⁰?
Apply the universal-hash bound.
A 40-bit tag under the stated family and independence assumptions; authentication still has its own failure budget.
What is min-entropy if Eve’s optimal guess succeeds with probability 1/8?
Take minus the binary logarithm.
Three bits, regardless of how long the encoded string is.
Must the universal-hash seed be secret?
Distinguish independent from hidden.
No. A strong extractor permits a public seed, provided it is chosen independently as required by the theorem.
If the certified post-transcript entropy is only 70 bits at the same εPA, what happens?
Compare entropy with the 80-bit extraction penalty.
The conservative bound permits no positive output; abort key generation.
Why is an assumed entropy bound insufficient for a deployment?
Ask how observations imply that bound.
It needs a protocol-specific security theorem and validated device assumptions linking the measured data to Eve’s information.
For x=1011001, use the chapter parity-check matrix to correct a flip at position five. Then flip positions one and two instead and show the one-error decoder fails.
The syndrome of a single error is the corresponding matrix column.
Hx=010. With the fifth bit flipped, Hy=111, so the difference is 101, selecting position five. With errors at one and two, the difference is 001 XOR 010=011, selecting position three. The decoder flips that third position and leaves errors at one, two, and three. The output has the same syndrome as x but is not x, which motivates independent verification.
Enumerate all 32 seeds of a 2×4 Toeplitz family. For every nonzero four-bit difference d, how many seeds give Td=00? Explain why the count is the same for all 15 differences.
Use the first nonzero coordinate of d to find two independent seed constraints.
For each nonzero d, the two output equations constrain two independent diagonal seed bits, leaving three of the five seed bits free. Exactly 2³=8 seeds collide, giving probability 8/32=1/4. Exhaustive enumeration in the checker verifies all 15 differences. A single convenient matrix is not enough to prove a family-wide collision bound.
Assume pre-transcript unsmoothed min-entropy 7500, reconciliation leakage 1300, a 40-bit verification tag, εPA=2⁻⁴⁰, and 128 consumed authentication bits. Find output length and net expansion, then state what the calculation has not established.
Subtract leakage and verification before the 80-bit extraction penalty.
The output length is floor(7500−1300−40−80)=6080 bits and net expansion is 6080−128=5952 bits. This assumes the 7500-bit bound is valid for the actual protocol, acceptance conditioning, and Eve system; it does not derive that bound from data. Correctness, authentication, and any estimation/smoothing errors still need their own compatible accounting.
Derive the conservative hash length from the unsmoothed leftover-hash inequality, and explain why revealing the hash seed does not violate its conclusion.
Solve (1/2) sqrt(2^(ℓ−k))≤ε, then compare with the course’s slightly shorter choice.
The exact inequality permits ℓ≤k−2 log₂(1/ε)+2. The course conservatively chooses ℓ≤k−2 log₂(1/ε), which gives distance at most ε/2. The theorem compares the joint state KFE with a uniform K independent of FE, so the public seed is already included in the adversary’s final information. It must still be independent of XE when chosen.