%%% Compute the complement to one of the hybrid distribution cumulative %%% %%% function defined in BLONDEAU-GERARD FSE 2011 i.e. P[C_k > tau] %%% %%% Parameters: %%% tau: is the relative threshold 0 < tau < 1 %%% q = p if considering the wrong key candidate %%% p_* if considering the correct key candidate %%% Ns: number of samples ($N |\Delta_0|/2$) function res=hybridcdf_comp(tau,q,Ns) %%% this coefficient determines the interval where Poisson approximation is used coeff = 3.0; if ( tau < q - coeff*sqrt(q/Ns) ) tau = (tau*Ns+0.5)/Ns; res = 1-exp(-Ns*Kullback_Bernoulli(tau,q)) * (q*sqrt(1-tau)/((q-tau)*sqrt(2*pi*tau*Ns)) + 1/sqrt(8*pi*tau*Ns)); else if ( tau > q + coeff*sqrt(q/Ns) ) tau = (tau*Ns+0.5)/Ns; res = exp(-Ns*Kullback_Bernoulli(tau,q)) * ((1-q)*sqrt(tau)/((tau-q)*sqrt(2*pi*(1-tau)*Ns)) + 1/sqrt(8*pi*tau*Ns)); else res = 1-poisscdf(floor(tau*Ns)+1,q*Ns); end end