## 3 Security Analysis
### Parameter Estimation with the Finite-Key Size  
In a practical QKD system, the number of photons sent is finite and the intensities cannot be infinite in \(Z\) windows or \(\widehat{X}\) windows. In this section, we consider the effects of the weak randomness on SNS TF-QKD with the finite-key size based on the universally composable framework [40]. To close the gap between the expected values and observed values, we exploit the Improved-Chernoff bound [41; 42; 43] to estimate the counting rate of single-photon states \(n_{1}\) and the phase-flip error rate \(e_{1}^{ph}\). Firstly, we make an introduction of the universally composable framework [40]:  
**Definition 1**. : _If the final key strings \(S_{A}\) and \(S_{B}\) of [PERSON] and [PERSON] satisfy the following conditions, the protocol is defined to be \(\varepsilon\)-secure:_  
* _Correctness. A protocol is_ \(\varepsilon_{cor}\)_-correct if_ \(S_{A}\) _and_ \(S_{B}\) _of [PERSON] and [PERSON] are not identical with the maximal probability of_ \(\varepsilon_{cor}\)_:_ \[\Pr(S_{A}\
eq S_{B})\leq\varepsilon_{cor},\]
* _Secrecy. The final key strings_ \(S\) _(_\(S_{A}\) _or_ \(S_{B}\)_) are said to be_ \(\varepsilon_{\text{sec}}\)_-secret with respect to the [PERSON] holding a quantum system_ \(E\) _if:_ \[\frac{1}{2}p_{abort}\|\rho_{S}-\rho_{U}\otimes\rho_{E}\|\leq\varepsilon_{\text {sec}},\]  
_where_ \(p_{abort}\) _denotes the probability of protocol failure aborted,_ \(\rho_{S}\) _denotes the classical-quantum states of the system for [PERSON] (Bob) and system_ \(E\)_, and_ \(\rho_{U}\) _denotes the fully mixed states on_ \(S_{A}\) _or_ \(S_{B}\)The security against general attacks based on the entropic uncertainty relation for the smooth min-extropy in the SNS TF-QKD has been proven. According to the finite-key analysis based on the universally composable framework, the length of secret keys can be presented as follows [16; 44]:  
\[\ell=n_{1}\Big{[}1-H(\epsilon_{1}^{ph})\Big{]}-leak_{EC}-\log_{2}\frac{2}{ \varepsilon_{cor}}-2\log_{2}\frac{1}{\sqrt{2}\varepsilon_{pA}\delta}. \tag{13}\]  
According to the composable framework, the security coefficient of the whole protocol is \(\varepsilon_{tol}=\varepsilon_{cor}+\varepsilon_{\text{sec}}\), where \(\varepsilon_{\text{sec}}=2\hat{\varepsilon}+4\hat{\varepsilon}+\varepsilon_{ PA}+\varepsilon_{n1}\). \(\varepsilon_{cor}\) is the failure probability of error correction; \(\hat{\varepsilon}\) and \(\varepsilon_{PA}\) are the failure probability for the estimation of the phase-flip error rate and privacy amplification; \(\varepsilon_{n1}\) is the failure probability for estimation of the lower bound of the counting rate of single-photon states. \(leak_{EC}=fn_{t}h(E_{z})\), where \(n_{t}\) is final length of the secret key string, \(E_{z}\) is the corresponding error rate. In \(\hat{X}\) windows, [PERSON] and [PERSON] do not announce any phase information. The coherent states sent out can be regarded as a classical mixture of different photon numbers. We denote \(\rho_{v}\), \(\rho_{a}\) and \(\rho_{b}\). Let \(N_{a\beta}\) be the number of the events which [PERSON] sends \(\rho_{a}\) and [PERSON] sends \(\rho_{\beta}\), where \((\alpha,\beta)\in\{(v,v),(v,a),(a,v),(v,b),(b,v)\}\). Here, we suppose that [PERSON] and [PERSON] repeat the _Preparation_ and _Measurement_ step \(N\) times, so \(N_{a\beta}\) can be expressed as follows [16]:  
\[N_{vv}=\Big{[}(1-p_{\mu_{a}}-p_{\mu_{a}})^{2}(1-p_{z})^{2}+2(1-p_{\mu_{a}}-p_{ \mu_{b}})(1-p_{z})p_{z}p_{z0}\Big{]}N, \tag{14}\]  
\[N_{va}=N_{av}=\Big{[}(1-p_{\mu_{a}}-p_{\mu_{b}})(1-p_{z})^{2}p_{\mu_{a}}+(1-p_ {z})p_{z}p_{z0}p_{\mu_{a}}\Big{]}N, \tag{15}\]  
\[N_{vb}=N_{bv}=\Big{[}(1-p_{z})^{2}(1-p_{\mu_{a}}-p_{\mu_{b}})p_{\mu_{b}}+(1-p_ {z})p_{z}p_{z0}p_{\mu_{b}}\Big{]}N. \tag{16}\]  
let \(n_{a\beta}\) be the number of effective events of one-detector heralded corresponding to the \(N_{a\beta}\).