Abstract
The arbitrary-centered discrete Gaussian sampler is a fundamental subroutine in implementing lattice trapdoor sampling algorithms. However, existing approaches typically rely on either a fast implementation of another discrete Gaussian sampler or pre-computations with regards to some specific discrete Gaussian distributions with fixed centers and standard deviations. These approaches may only support sampling from standard deviations within a limited range, or cannot efficiently sample from arbitrary standard deviations determined on-the-fly at run-time.
In this paper, we propose a compact and scalable rejection sampling algorithm by sampling from a continuous normal distribution and performing rejection sampling on rounded samples. Our scheme does not require pre-computations related to any specific discrete Gaussian distributions. Our scheme can sample from both arbitrary centers and arbitrary standard deviations determined on-the-fly at run-time. In addition, we show that our scheme only requires a low number of trials close to 2 per sample on average, and our scheme maintains good performance when scaling up the standard deviation. We also provide a concrete error analysis of our scheme based on the Rényi divergence. We implement our sampler and analyse its performance in terms of storage and speed compared to previous results. Our sampler’s running time is center-independent and is therefore applicable to implementation of convolution-style lattice trapdoor sampling and identity-based encryption resistant against timing side-channel attacks.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
One may employ different implementations for different \(\sigma \), similar to the implementation of Falcon.
- 2.
- 3.
Our implementation is available at https://github.com/raykzhao/gaussian_ac.
- 4.
Here we compare the performance with our center-independent run-time implementation because the implementation in [17] is constant-time.
References
Aumasson, J.P.: Guidelines for low-level cryptography software (2019). https://github.com/veorq/cryptocoding. Accessed 28 Jan 2020
Bai, S., Langlois, A., Lepoint, T., Stehlé, D., Steinfeld, R.: Improved security proofs in lattice-based cryptography: using the Rényi divergence rather than the statistical distance. In: Iwata, T., Cheon, J.H. (eds.) ASIACRYPT 2015. LNCS, vol. 9452, pp. 3–24. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-48797-6_1
Bert, P., Fouque, P.-A., Roux-Langlois, A., Sabt, M.: Practical implementation of ring-SIS/LWE based signature and IBE. In: Lange, T., Steinwandt, R. (eds.) PQCrypto 2018. LNCS, vol. 10786, pp. 271–291. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-79063-3_13
Devroye, L.: Non-Uniform Random Variate Generation. Springer, New York (1986). https://doi.org/10.1007/978-1-4613-8643-8
Du, Y., Wei, B., Zhang, H.: A rejection sampling algorithm for off-centered discrete Gaussian distributions over the integers. Sci. China Inf. Sci. 62(3), 39103:1–39103:3 (2019)
Ducas, L., Durmus, A., Lepoint, T., Lyubashevsky, V.: Lattice signatures and bimodal Gaussians. In: Canetti, R., Garay, J.A. (eds.) CRYPTO 2013. LNCS, vol. 8042, pp. 40–56. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-40041-4_3
Ducas, L., Lyubashevsky, V., Prest, T.: Efficient identity-based encryption over NTRU lattices. In: Sarkar, P., Iwata, T. (eds.) ASIACRYPT 2014. LNCS, vol. 8874, pp. 22–41. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-662-45608-8_2
Ducas, L., Nguyen, P.Q.: Faster gaussian lattice sampling using lazy floating-point arithmetic. In: Wang, X., Sako, K. (eds.) ASIACRYPT 2012. LNCS, vol. 7658, pp. 415–432. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-34961-4_26
Fog, A.: VCL C++ vector class library. www.agner.org/optimize/vectorclass.pdf. Accessed 01 Aug 2019
Gentry, C., Peikert, C., Vaikuntanathan, V.: Trapdoors for hard lattices and new cryptographic constructions. In: STOC, pp. 197–206. ACM (2008)
Hülsing, A., Lange, T., Smeets, K.: Rounded Gaussians. In: Abdalla, M., Dahab, R. (eds.) PKC 2018. LNCS, vol. 10770, pp. 728–757. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-76581-5_25
Karney, C.F.F.: Sampling exactly from the normal distribution. ACM Trans. Math. Softw. 42(1), 3:1–3:14 (2016)
Knuth, D., Yao, A.: Algorithms and Complexity: New Directions and Recent Results, chap. The complexity of nonuniform random number generation. Academic Press, Cambridge (1976)
Aguilar-Melchor, C., Albrecht, M.R., Ricosset, T.: Sampling from arbitrary centered discrete gaussians for lattice-based cryptography. In: Gollmann, D., Miyaji, A., Kikuchi, H. (eds.) ACNS 2017. LNCS, vol. 10355, pp. 3–19. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-61204-1_1
Melchor, C.A., Ricosset, T.: CDT-based Gaussian sampling: From multi to double precision. IEEE Trans. Comput. 67(11), 1610–1621 (2018)
Micciancio, D., Peikert, C.: Trapdoors for lattices: simpler, tighter, faster, smaller. In: Pointcheval, D., Johansson, T. (eds.) EUROCRYPT 2012. LNCS, vol. 7237, pp. 700–718. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-29011-4_41
Micciancio, D., Walter, M.: Gaussian sampling over the integers: efficient, generic, constant-time. In: Katz, J., Shacham, H. (eds.) CRYPTO 2017. LNCS, vol. 10402, pp. 455–485. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-63715-0_16
Peikert, C.: An efficient and parallel Gaussian sampler for lattices. In: Rabin, T. (ed.) CRYPTO 2010. LNCS, vol. 6223, pp. 80–97. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-14623-7_5
Prest, T.: Sharper bounds in lattice-based cryptography using the Rényi divergence. In: Takagi, T., Peyrin, T. (eds.) ASIACRYPT 2017. LNCS, vol. 10624, pp. 347–374. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-70694-8_13
Prest, T., et al.: Falcon: fast-fourier lattice-based compact signatures over NTRU. https://falcon-sign.info/ (2017). Accessed 31 Oct 2018
Prest, T., Ricosset, T., Rossi, M.: Simple, fast and constant-time Gaussian sampling over the integers for Falcon. In: Second PQC Standardization Conference. https://csrc.nist.gov/CSRC/media/Events/Second-PQC-Standardization-Conference/documents/accepted-papers/rossi-simple-fast-constant.pdf (2019). Accessed 13 Aug 2019
Thomas, D.B., Luk, W., Leong, P.H.W., Villasenor, J.D.: Gaussian random number generators. ACM Comput. Surv. 39(4), 11 (2007)
von Neumann, J.: Various techniques used in connection with random digits. In: Householder, A., Forsythe, G., Germond, H. (eds.) Monte Carlo Method, pp. 36–38 (1951). National Bureau of Standards Applied Mathematics Series, 12, Washington, D.C.: U.S. Government Printing Office
Walter, M.: Private communication (2020). Accessed 29 Jan 2020
Zhang, Z., Chen, C., Hoffstein, J., Whyte, W.: NIST PQ submission: pqNTRUSign a modular lattice signature scheme (2017). https://www.onboardsecurity.com/nist-post-quantum-crypto-submission. Accessed 01 Aug 2019
Zhao, R.K., Steinfeld, R., Sakzad, A.: FACCT: fast, compact, and constant-time discrete Gaussian sampler over integers. IEEE Trans. Comput. 69(1), 126–137 (2020)
Acknowledgments
Ron Steinfeld was supported in part by ARC Discovery Project grant DP180102199.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendices
A Precision Analysis
To avoid sampling a uniformly random real r with high absolute precisions at rejection steps 11 and 23 in Algorithm 2, and step 4 in Algorithm 3, we adapt the comparison approach similar to [26]. Assume an IEEE-754 floating-point value \(f\in (0,1)\) with \((\delta _{f}+1)\)-bit precision is represented by \(f=\left( 1+mantissa\cdot 2^{-\delta _{f}}\right) \cdot 2^{exponent}\), where integer mantissa has \(\delta _{f}\) bits and \(exponent\in \mathbb {Z}^{-}\). To check \(r<f\), one can sample \(r_{m}\hookleftarrow \mathcal {U}\left( \{0,1\}^{\delta _{f}+1}\right) \), \(r_{e}\hookleftarrow \mathcal {U}\left( \{0,1\}^{l}\right) \), and check \(r_{m}<mantissa+2^{\delta _{f}}\) and \(r_{e}<2^{l+exponent+1}\) instead for some l such that \(l+exponent+1\ge 0\).
Here we analyse the precision requirement of \(r_e\). We have the following theorem for the worst-case acceptance rate in Algorithm 2:
Theorem 5
Assume \(x\in [-\tau ,\tau ]\) and \(y\in [-\tau \sigma -1,\tau \sigma +1]\). In worst case, step 11 in Algorithm 2 has the acceptance rate:
and step 23 in Algorithm 2 has the acceptance rate:
Proof
For \(b=0\) and \(y\le -1/2\), we have the acceptance rate \(p_1=\exp \left( -Y_1/\left( 2\sigma ^2\right) \right) \) at step 11 in Algorithm 2 where:
Similarly, for \(b=1\) and \(y\ge 1/2\), we have the acceptance rate \(p_2=\exp \left( -Y_2/\left( 2\sigma ^2\right) \right) \) at step 23 in Algorithm 2 where:
\(\square \)
Let \(\varDelta \le 1/2\) be the maximum relative error of the right hand side computations at rejection steps 11 and 23 in Algorithm 2, and step 4 in Algorithm 3. For \(\exp \left( -Y_1/\left( 2\sigma ^2\right) \right) \) at step 11 in Algorithm 2, we have:
Similarly, for \(\exp \left( -Y_2/\left( 2\sigma ^2\right) \right) \) at step 23 in Algorithm 2, we have:
For \(\exp \left( -c_{F}^2/\left( 2\sigma ^2\right) \right) /S\) at step 4 in Algorithm 3, we have:
Therefore, we have:
Since the probability \(\mathrm {Pr}\left[ -\tau \le x\le \tau \right] =\text {erf}\left( \tau /\sqrt{2}\right) \) for \(x\hookleftarrow \mathcal {N}(0,1)\), to ensure \(1-\mathrm {Pr}\left[ -\tau \le x\le \tau \right] \le 2^{-\lambda }\), we need \(\tau \ge \sqrt{2}\cdot \text {erf}^{-1}\left( 1-2^{-\lambda }\right) \). Therefore, for \(\lambda =128\) and \(\sigma \in \left[ 2,2^{20}\right] \), we have \(\tau \ge 13.11\), \(exponent\ge -23\), and thus \(l\ge 22\), i.e. \(r_e\) needs to have at least 22 bits.
B Proof of Algorithm 1
Since Algorithm 1 was an exercise in [4] without solutions, here we provide a brief proof of Algorithm 1.
Normalisation Factor. By definition, we have the normalisation factor:
Correctness. Let \(z_0=\lfloor x\rceil \). We have \(Y=\left( \left| z_0\right| +1/2\right) ^2-x^2\ge 0\) for any \(x\in \mathbb {R}\). Therefore, the rejection condition \(\exp \left( -Y/\left( 2\sigma ^2\right) \right) \in \left( 0,1\right] \). We have the output distribution:
Rejection Rate. By definition, we have the output probability density function \(f(x)=c\cdot \exp \left( -\frac{\left( |\lfloor x\rceil |+1/2\right) ^2}{2\sigma ^2}\right) \) and the input probability density function \(g(x)=\rho _{\sigma }\left( x\right) /\left( \sigma \sqrt{2\pi }\right) \). The expected number of trials can be written as:
We have:
Therefore,
where the second inequality follows from the inequality of 1/c and the third inequality follows from the fact that \(\rho _{\sigma }\left( \mathbb {Z}\right) \ge \sigma \sqrt{2\pi }-1\). Thus, we have the rejection probability:
when \(\epsilon \) is small.
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
Zhao, R.K., Steinfeld, R., Sakzad, A. (2020). COSAC: COmpact and Scalable Arbitrary-Centered Discrete Gaussian Sampling over Integers. In: Ding, J., Tillich, JP. (eds) Post-Quantum Cryptography. PQCrypto 2020. Lecture Notes in Computer Science(), vol 12100. Springer, Cham. https://doi.org/10.1007/978-3-030-44223-1_16
Download citation
DOI: https://doi.org/10.1007/978-3-030-44223-1_16
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-44222-4
Online ISBN: 978-3-030-44223-1
eBook Packages: Computer ScienceComputer Science (R0)