Skip to main content

Fast Secure Comparison for Medium-Sized Integers and Its Application in Binarized Neural Networks

  • Conference paper
  • First Online:
Topics in Cryptology – CT-RSA 2019 (CT-RSA 2019)

Part of the book series: Lecture Notes in Computer Science ((LNSC,volume 11405))

Included in the following conference series:

Abstract

In 1994, Feige, Kilian, and Naor proposed a simple protocol for secure 3-way comparison of integers a and b from the range [0, 2]. Their observation is that for \(p=7\), the Legendre symbol \(\left( x\mid p\right) \) coincides with the sign of x for \(x=a-b\in [-2,2]\), thus reducing secure comparison to secure evaluation of the Legendre symbol. More recently, in 2011, Yu generalized this idea to handle secure comparisons for integers from substantially larger ranges [0, d], essentially by searching for primes for which the Legendre symbol coincides with the sign function on \([-d,d]\). In this paper, we present new comparison protocols based on the Legendre symbol that additionally employ some form of error correction. We relax the prime search by requiring that the Legendre symbol encodes the sign function in a noisy fashion only. Practically, we use the majority vote over a window of \(2k+1\) adjacent Legendre symbols, for small positive integers k. Our technique significantly increases the comparison range: e.g., for a modulus of 60 bits, d increases by a factor of 2.8 (for \(k=1\)) and 3.8 (for \(k=2\)) respectively. We give a practical method to find primes with suitable noisy encodings.

We demonstrate the practical relevance of our comparison protocol by applying it in a secure neural network classifier for the MNIST dataset. Concretely, we discuss a secure multiparty computation based on the binarized multi-layer perceptron of Hubara et al., using our comparison for the second and third layers.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Ankeny [2] attributes this result to Chowla, but does not provide a reference.

  2. 2.

    In the literature, this is also written as \(n_1(p) = \mathrm {\Omega }(\log (p) \cdot \log \log \log p)\), where \(\mathrm {\Omega }\) is Hardy–Littlewood’s Big Omega: \(f(n) = \mathrm {\Omega }(g(n)) \iff \lim \sup _{n \rightarrow \infty } |f(n)/g(n)|>0\).

  3. 3.

    The prime moduli are \(p=9409569905028393239\) and \(p'=15569949805843283171\).

References

  1. Abspoel, M.: Search for primes with high \(d_1, d_2\) (2018). https://github.com/abspoel/dk-search

  2. Ankeny, N.C.: The least quadratic non residue. Ann. Math. 55(1), 65–72 (1952)

    Article  MathSciNet  Google Scholar 

  3. Feige, U., Kilian, J., Naor, M.: A minimal model for secure computation (extended abstract). In: Proceedings of STOC 1994, pp. 554–563 (1994)

    Google Scholar 

  4. Fridlender, V.R.: On the least \(n\)th power non-residue. Dokl. Akad. Nauk. SSSR 66, 351–352 (1949)

    MathSciNet  Google Scholar 

  5. Graham, S.W., Ringrose, C.J.: Lower bounds for least quadratic non-residues. In: Berndt, B.C., et al. (eds.) Analytic Number Theory: Proceedings of a Conference in Honor of Paul T. Bateman, vol. 85, pp. 269–309. Springer, Boston (1990). https://doi.org/10.1007/978-1-4612-3464-7_18

    Chapter  Google Scholar 

  6. Hildebrand, A.: On the least pair of consecutive quadratic nonresidues. Mich. Math. J. 34(1), 57–62 (1987)

    Article  MathSciNet  Google Scholar 

  7. Hubara, I., Courbariaux, M., Soudry, D., El-Yaniv, R., Bengio, Y.: Quantized neural networks: training neural networks with low precision weights and activations. J. Mach. Learn. Res. 18(187), 1–30 (2018)

    MathSciNet  MATH  Google Scholar 

  8. Hudson, R.H.: The least pair of consecutive character non-residues. J. Reine Angew. Math. (281), 219–220 (1976)

    Google Scholar 

  9. Jacobsthal, E.: Anwendungen einer Formel aus der Theorie der quadratischen Reste. Ph.D. thesis, Friedrich-Wilhelms-Universität, Berlin, Germany (1906)

    Google Scholar 

  10. Lamzouri, Y., Li, X., Soundararajan, K.: Conditional bounds for the least quadratic non-residue and related problems. Math. Comput. 84(295), 2391–2412 (2015)

    Article  MathSciNet  Google Scholar 

  11. Linnik, U.V.: On the least prime in an arithmetic progression. I. The basic theorem. Rec. Math. [Mat. Sbornik] N.S. 15(57), 139–178 (1944)

    MathSciNet  MATH  Google Scholar 

  12. Lukes, R.F.: A very fast electronic number sieve. Ph.D. thesis, University of Manitoba, Winnipeg, Canada (1995)

    Google Scholar 

  13. Pritchard, P.: A sublinear additive sieve for finding prime numbers. Commun. ACM 24(1), 18–23 (1981)

    Article  MathSciNet  Google Scholar 

  14. Salié, H.: Über den kleinsten positiven quadratischen Nichtrest nach einer Primzahl. Math. Nachr. 3(1), 7–8 (1949)

    Article  MathSciNet  Google Scholar 

  15. Schoenmakers, B.: MPyC - secure multiparty computation in Python, v0.4.7. GitHub (2018). https://github.com/lschoe/mpyc

  16. Sorenson, J.P.: The pseudosquares prime sieve. In: Hess, F., Pauli, S., Pohst, M. (eds.) ANTS 2006. LNCS, vol. 4076, pp. 193–207. Springer, Heidelberg (2006). https://doi.org/10.1007/11792086_15

    Chapter  Google Scholar 

  17. Sun, Z.H.: Consecutive numbers with the same Legendre symbol. Proc. Am. Math. Soc. 130(9), 2503–2507 (2002)

    Article  MathSciNet  Google Scholar 

  18. Toft, T.: Primitives and applications for multi-party computation. Ph.D. thesis, Aarhus Universitet, Denmark (2007)

    Google Scholar 

  19. Treviño, E.: The least \(k\)th power non-residue. J. Number Theory 149, 201–224 (2015)

    Article  MathSciNet  Google Scholar 

  20. Xylouris, T.: Über die Nullstellen der Dirichletschen L-Funktionen und die kleinste Primzahl in einer arithmetischen Progression. Ph.D. thesis, Rheinischen Friedrich-Wilhelms-Universität Bonn, Germany (2011)

    Google Scholar 

  21. Yao, A.C.: Protocols for secure computations. In: 23rd Annual Symposium on FOCS 1982, pp. 160–164 (1982)

    Google Scholar 

  22. Yu, C.H.: Sign modules in secure arithmetic circuits. Cryptology ePrint Archive, Report 2011/539 (2011). http://eprint.iacr.org/2011/539

Download references

Acknowledgments

We thank Frank Blom for running all our 3-party experiments on his 3PC-LAN setup. This work has received funding from the European Union’s Horizon 2020 research and innovation program under grant agreements No 731583 (SODA) and No 780477 (PRIViLEDGE).

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Mark Abspoel or Niek J. Bouman .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Abspoel, M., Bouman, N.J., Schoenmakers, B., de Vreede, N. (2019). Fast Secure Comparison for Medium-Sized Integers and Its Application in Binarized Neural Networks. In: Matsui, M. (eds) Topics in Cryptology – CT-RSA 2019. CT-RSA 2019. Lecture Notes in Computer Science(), vol 11405. Springer, Cham. https://doi.org/10.1007/978-3-030-12612-4_23

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-12612-4_23

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-12611-7

  • Online ISBN: 978-3-030-12612-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics