Skip to main content

Numerical Method for Comparison on Homomorphically Encrypted Numbers

  • Conference paper
  • First Online:
Advances in Cryptology – ASIACRYPT 2019 (ASIACRYPT 2019)

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

Abstract

We propose a new method to compare numbers which are encrypted by Homomorphic Encryption (HE). Previously, comparison and min/max functions were evaluated using Boolean functions where input numbers are encrypted bit-wise. However, the bit-wise encryption methods require relatively expensive computations for basic arithmetic operations such as addition and multiplication.

In this paper, we introduce iterative algorithms that approximately compute the min/max and comparison operations of several numbers which are encrypted word-wise. From the concrete error analyses, we show that our min/max and comparison algorithms have \(\varTheta (\alpha )\) and \(\varTheta (\alpha \log \alpha )\) computational complexity to obtain approximate values within an error rate \(2^{-\alpha }\), while the previous minimax polynomial approximation method requires the exponential complexity \(\varTheta (2^{\alpha /2})\) and \(\varTheta (\sqrt{\alpha }\cdot 2^{\alpha /2})\), respectively. Our algorithms achieve (quasi-)optimality in terms of asymptotic computational complexity among polynomial approximations for min/max and comparison operations. The comparison algorithm is extended to several applications such as computing the top-k elements and counting numbers over the threshold in encrypted state.

Our method enables word-wise HEs to enjoy comparable performance in practice with bit-wise HEs for comparison operations while showing much better performance on polynomial operations. Computing an approximate maximum value of any two \(\ell \)-bit integers encrypted by HEAAN, up to error \(2^{\ell -10}\), takes only 1.14 ms in amortized running time, which is comparable to the result based on bit-wise HEs.

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

References

  1. Albrecht, M.R.: A sage module for estimating the concrete security of learning with errors instances (2017). https://bitbucket.org/malb/lwe-estimator

  2. Albrecht, M.R., Player, R., Scott, S.: On the concrete hardness of learning with errors. J. Math. Cryptol. 9(3), 169–203 (2015)

    Article  MathSciNet  Google Scholar 

  3. Bernstein, S.: Sur la meilleure approximation de \(|\)x\(|\) par des polynomes de degrés donnés. Acta Math. 37(1), 1–57 (1914)

    Article  MathSciNet  Google Scholar 

  4. Bos, J.W., Lauter, K., Loftus, J., Naehrig, M.: Improved security for a ring-based fully homomorphic encryption scheme. In: Stam, M. (ed.) IMACC 2013. LNCS, vol. 8308, pp. 45–64. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-45239-0_4

    Chapter  Google Scholar 

  5. Boura, C., Gama, N., Georgieva, M.: Chimera: a unified framework for B/FV, TFHE and HEAAN fully homomorphic encryption and predictions for deep learning. Cryptology ePrint Archive, Report 2018/758 (2018). https://eprint.iacr.org/2018/758

  6. Bourse, F., Minelli, M., Minihold, M., Paillier, P.: Fast homomorphic evaluation of deep discretized neural networks. In: Shacham, H., Boldyreva, A. (eds.) CRYPTO 2018. LNCS, vol. 10993, pp. 483–512. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-96878-0_17

    Chapter  Google Scholar 

  7. Brakerski, Z.: Fully homomorphic encryption without modulus switching from classical GapSVP. In: Safavi-Naini, R., Canetti, R. (eds.) CRYPTO 2012. LNCS, vol. 7417, pp. 868–886. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-32009-5_50

    Chapter  Google Scholar 

  8. Brakerski, Z., Gentry, C., Vaikuntanathan, V.: (Leveled) fully homomorphic encryption without bootstrapping. In: Proceedings of ITCS, pp. 309–325. ACM (2012)

    Google Scholar 

  9. Brown, K.: Probability of intersecting intervals. https://www.mathpages.com/home/kmath580/kmath580.htm

  10. Chatterjee, A., SenGupta, I.: Sorting of fully homomorphic encrypted cloud data: can partitioning be effective? IEEE Trans. Serv. Comput. (2017)

    Google Scholar 

  11. Cheon, J.H., et al.: Toward a secure drone system: flying with real-time homomorphic authenticated encryption. IEEE Access 6, 24325–24339 (2018)

    Article  Google Scholar 

  12. Cheon, J.H., Jeong, J., Lee, J., Lee, K.: Privacy-preserving computations of predictive medical models with minimax approximation and non-adjacent form. In: Brenner, M., et al. (eds.) FC 2017. LNCS, vol. 10323, pp. 53–74. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-70278-0_4

    Chapter  Google Scholar 

  13. Cheon, J.H., Kim, A., Kim, M., Song, Y.: Homomorphic encryption for arithmetic of approximate numbers. In: Takagi, T., Peyrin, T. (eds.) ASIACRYPT 2017. LNCS, vol. 10624, pp. 409–437. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-70694-8_15

    Chapter  Google Scholar 

  14. Cheon, J.H., Kim, D., Kim, Y., Song, Y.: Ensemble method for privacy-preserving logistic regression based on homomorphic encryption. IEEE Access 6, 46938–46948 (2018)

    Article  Google Scholar 

  15. Cheon, J.H., Kim, D., Park, J.H.: Towards a practical clustering analysis over encrypted data. Cryptology ePrint Archive, Report 2019/465 (2019). https://eprint.iacr.org/2019/465

  16. Cheon, J.H., Kim, M., Kim, M.: Search-and-compute on encrypted data. In: Brenner, M., Christin, N., Johnson, B., Rohloff, K. (eds.) FC 2015. LNCS, vol. 8976, pp. 142–159. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-48051-9_11

    Chapter  Google Scholar 

  17. Chialva, D., Dooms, A.: Conditionals in homomorphic encryption and machine learning applications. Cryptology ePrint Archive, Report 2018/1032 (2018). https://eprint.iacr.org/2018/1032

  18. Chillotti, I., Gama, N., Georgieva, M., Izabachène, M.: Faster fully homomorphic encryption: bootstrapping in less than 0.1 seconds. In: Cheon, J.H., Takagi, T. (eds.) ASIACRYPT 2016. LNCS, vol. 10031, pp. 3–33. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-53887-6_1

    Chapter  MATH  Google Scholar 

  19. Chillotti, I., Gama, N., Georgieva, M., Izabachène, M.: Faster packed homomorphic operations and efficient circuit bootstrapping for TFHE. In: Takagi, T., Peyrin, T. (eds.) ASIACRYPT 2017. LNCS, vol. 10624, pp. 377–408. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-70694-8_14

    Chapter  Google Scholar 

  20. Costache, A., Smart, N.P.: Which ring based somewhat homomorphic encryption scheme is best? In: Sako, K. (ed.) CT-RSA 2016. LNCS, vol. 9610, pp. 325–340. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-29485-8_19

    Chapter  Google Scholar 

  21. Crawford, J.L., Gentry, C., Halevi, S., Platt, D., Shoup, V.: Doing real work with FHE: the case of logistic regression. In: Proceedings of the 6th Workshop on Encrypted Computing and Applied Homomorphic Cryptography, pp. 1–12. ACM (2018)

    Google Scholar 

  22. van Dijk, M., Gentry, C., Halevi, S., Vaikuntanathan, V.: Fully homomorphic encryption over the integers. In: Gilbert, H. (ed.) EUROCRYPT 2010. LNCS, vol. 6110, pp. 24–43. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-13190-5_2

    Chapter  Google Scholar 

  23. Ducas, L., Micciancio, D.: FHEW: bootstrapping homomorphic encryption in less than a second. In: Oswald, E., Fischlin, M. (eds.) EUROCRYPT 2015. LNCS, vol. 9056, pp. 617–640. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46800-5_24

    Chapter  MATH  Google Scholar 

  24. Emmadi, N., Gauravaram, P., Narumanchi, H., Syed, H.: Updates on sorting of fully homomorphic encrypted data. In: 2015 International Conference on Cloud Computing Research and Innovation (ICCCRI), pp. 19–24. IEEE (2015)

    Google Scholar 

  25. Eremenko, A., Yuditskii, P.: Uniform approximation of sgn(x) by polynomials and entire functions. J. d’Analyse Mathématique 101(1), 313–324 (2007)

    Article  MathSciNet  Google Scholar 

  26. Fan, J., Vercauteren, F.: Somewhat practical fully homomorphic encryption. IACR Cryptology ePrint Archive, 2012:144 (2012)

    Google Scholar 

  27. Gentry, C.: A fully homomorphic encryption scheme. Ph.D. thesis, Stanford University (2009). http://crypto.stanford.edu/craig

  28. Gentry, C., Halevi, S., Smart, N.P.: Better bootstrapping in fully homomorphic encryption. In: Fischlin, M., Buchmann, J., Manulis, M. (eds.) PKC 2012. LNCS, vol. 7293, pp. 1–16. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-30057-8_1

    Chapter  Google Scholar 

  29. Gentry, C., Sahai, A., Waters, B.: Homomorphic encryption from learning with errors: conceptually-simpler, asymptotically-faster, attribute-based. In: Canetti, R., Garay, J.A. (eds.) CRYPTO 2013. LNCS, vol. 8042, pp. 75–92. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-40041-4_5

    Chapter  Google Scholar 

  30. Gilad-Bachrach, R., Dowlin, N., Laine, K., Lauter, K., Naehrig, M., Wernsing, J.: Cryptonets: applying neural networks to encrypted data with high throughput and accuracy. In: International Conference on Machine Learning (2016)

    Google Scholar 

  31. Goldschmidt, R.E.: Applications of division by convergence. Ph.D. thesis, Massachusetts Institute of Technology (1964)

    Google Scholar 

  32. Halevi, S., Shoup, V.: Bootstrapping for HElib. In: Oswald, E., Fischlin, M. (eds.) EUROCRYPT 2015. LNCS, vol. 9056, pp. 641–670. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46800-5_25

    Chapter  Google Scholar 

  33. Jackson, D.: The Theory of Approximation, vol. 11. American Mathematical Society (1930)

    Google Scholar 

  34. Jäschke, A., Armknecht, F.: Unsupervised machine learning on encrypted data. In: Cid, C., Jacobson Jr., M. (eds.) SAC 2018. LNCS, pp. 453–478. Springer, Cham (2018). https://doi.org/10.1007/978-3-030-10970-7_21

    Chapter  Google Scholar 

  35. Kim, A., Song, Y., Kim, M., Lee, K., Cheon, J.H.: Logistic regression model training based on the approximate homomorphic encryption. BMC Med. Genomics 11(4), 83 (2018)

    Article  Google Scholar 

  36. Kim, M., Song, Y., Wang, S., Xia, Y., Jiang, X.: Secure logistic regression based on homomorphic encryption: design and evaluation. JMIR Med. Inform. 6(2), e19 (2018)

    Article  Google Scholar 

  37. Kocabas, O., Soyata, T.: Utilizing homomorphic encryption to implement secure and private medical cloud computing. In: 2015 IEEE 8th International Conference on Cloud Computing (CLOUD), pp. 540–547. IEEE (2015)

    Google Scholar 

  38. Pachón, R., Trefethen, L.N.: Barycentric-Remez algorithms for best polynomial approximation in the chebfun system. BIT Numer. Math. 49(4), 721 (2009)

    Article  MathSciNet  Google Scholar 

  39. Paterson, M.S., Stockmeyer, L.J.: On the number of nonscalar multiplications necessary to evaluate polynomials. SIAM J. Comput. 2(1), 60–66 (1973)

    Article  MathSciNet  Google Scholar 

  40. Phillips, G.M.: Best approximation. In: Phillips, G.M. (ed.) Interpolation and Approximation by Polynomials. CBM, pp. 49–118. Springer, New York (2003). https://doi.org/10.1007/0-387-21682-0_2

    Chapter  Google Scholar 

  41. Powell, M.J.D.: Approximation Theory and Methods. Cambridge University Press, Cambridge (1981)

    Book  Google Scholar 

  42. Rivest, R.L., Adleman, L., Dertouzos, M.L.: On data banks and privacy homomorphisms. Found. Secur. Comput. 4(11), 169–180 (1978)

    MathSciNet  Google Scholar 

  43. Togan, M., Morogan, L., Plesca, C.: Comparison-based applications for fully homomorphic encrypted data. In: Proceedings of the Romanian Academy-Series A: Mathematics, Physics, Technical Sciences, Information Science, vol. 16, p. 329 (2015)

    Google Scholar 

  44. Wilkes, M.V.: The Preparation of Programs for an Electronic Digital Computer: with Special Reference to the EDSAC and the Use of a Library of Subroutines. Addison-Wesley Press (1951)

    Google Scholar 

Download references

Acknowledgement

We thank Minki Hhan for suggesting a new interpretation on the efficiency of our algorithms, and Yongsoo Song for several valuable comments. We also thank to anonymous reviewers of ASIACRYPT 2019. This work was supported by the National Research Foundation of Korea (NRF) Grant funded by the Korean Government (MSIT) (No. 2017R1A5A1015626).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jung Hee Cheon .

Editor information

Editors and Affiliations

A Proofs

A Proofs

Proof of Theorem 3. By Theorem 2, the error of \(\texttt {Max}(\cdot ,\cdot ;d)\) algorithm from the true value is bounded by \(2^{(-\alpha - \log \log n)}= 2^{-\alpha }/\log n\). Note from the proof of Lemma 2 that the output of the square root algorithm \(\texttt {Sqrt}(x;d)\) is always smaller than the true value \(\sqrt{x}\), so that the same holds for the max algorithm \(\texttt {Max}(\cdot , \cdot ;d)\). This means that \(a_{i,1} = \texttt {Max}(a_{2i-1,0}, a_{2i,0};d)\) can be written \(a_{i,1} = \max (a_{2i-1,0}, a_{2i,0}) - \epsilon _i\) for \(1\le i \le n/2\) with \(0 \le \epsilon _i \le 2^{-\alpha }/\log n \). Now we have

$$\begin{aligned} \max (a_{2i-1,1},a_{2i,1})= & {} \max (\max (a_{4i-3,0},a_{4i-2,0}) - \epsilon _{2i-1}, \max (a_{4i-1,0}, a_{4i,0}) - \epsilon _{2i}) \\\ge & {} \max (a_{4i-3,0},a_{4i-2,0}, a_{4i-1,0}, a_{4i,0}) - \max (\epsilon _{2i-1}, \epsilon _{2i})\\\ge & {} \max (a_{4i-3,0},a_{4i-2,0}, a_{4i-1,0}, a_{4i,0}) - 2^{-\alpha }/\log n, \end{aligned}$$

which implies that the error of \(a_{i,2} = \texttt {Max}(a_{2i-1,1}, a_{2i,1};d)\) from \(\max (a_{2i-1,1}, a_{2i,1})\) is bounded by \(2\cdot 2^{-\alpha }/\log n\) for \(1\le i \le n/4\). We can repeat the above procedure to get the conclusion that the error of \(a_{1,\log n}\) from \(\max (a_1,..a_n)\) is bounded by \(\log n \cdot 2^{-\alpha }/\log n = 2^{-\alpha }\).

For the case of min algorithm we note that the approximate values are larger than the true values and we can apply a similar approach to the above with reversed inequalities.    \(\square \)

Proof of Theorem 5. Note that \(\texttt {MaxIdx}\) is a natural generalization of \(\texttt {Comp}\). Without loss of generality, we assume that \(a_1\) is the unique maximum element, and we only consider the error between the output \(b_1\) of \(\texttt {MaxIdx}\) and the real value 1. At Step 1–4, \((a_i)_{i=1}^n\) is scaled to \((b_i)_{i=1}^n\) whose sum is 1. Moreover, every input of \(\texttt {Inv}\) is bounded by \(\frac{n}{2^m}\) since \(\sum _{k=1}^{n} b_j\) is always set to be 1 before the \(\texttt {Inv}\) algorithm. Note that each \(b_j\) from the iterations is nothing but \(a_j^{m^t}/\sum _{i=1}^n a_i^{m^t}\) with t being increased by one as the iteration go. The error of \(\texttt {MaxIdx}\) algorithm is also composed of three parts as Theorem 4; an error from the convergence of \(\lim _{m\rightarrow \infty } a_1^m / \sum _{i=1}^n a_i^m = 1\), and an error from the approximation of \(1/(\sum _{i=1}^n b_i^m)\) by our \(\texttt {Inv}\) algorithm and an error coming from Steps 1–4.

Now, the error analysis is almost the same as the proof of Theorem 4 with minor differences in the values of errors. The first part of the error is bounded by \(n\cdot (1/c)^{m^t}\) since \(1 - \frac{a_1^N}{\sum _{i=1}^n b_i^N} = 1 - \frac{1}{1 + \sum _{i=2}^n (b_i/a_1)^N} \le n/c^N\). The second part of the error (from the \(\texttt {Inv}\) algorithm) is bounded by \((1-n^{-(m-1)})^{2^{d+1}}\) since \(n^{-(m-1)}\) is the lower bound of the denominators \(\sum _{i=1}^n b_i^m\) by Cauchy-Schwartz inequality. As a result, we can conclude that the conditions \(t \ge \frac{1}{\log m} [\log (\alpha + \log n + 1) - \log \log c]\) and \(d, d' \ge \log (\alpha + t+ 1) + (m -1)\log n - 1\) suffice to make the total error of \(\texttt {MaxIdx}\) less than \(2^{-\alpha }\) by a similar argument as in Theorem 4.    \(\square \)

Proof of Theorem 6. Without loss of generality, let \(a_i\) be the \(i^\text {th}\) maximum value \(\max _i\) for \(1\le i \le n\).

For \(1 \le i < k\), since \((1-2^{-\alpha })^{i}a_{i+1} > (1-2^{-\alpha })^{k}a_{k+1}\), we first obtain \(\frac{(1-2^{-\alpha })^i a_{i+1}}{2^{-\alpha }a_1} > c\). For \(j = 1\), the statement holds directly by Theorem 5. After obtaining \(m_1\), the algorithm takes \((\epsilon _1a_1, (1-\epsilon _2)a_2,...,(1-\epsilon _n)a_n)\) as an input of \(\texttt {MaxIdx}(\cdots ;d,d',m,t)\), where \(0 \le \epsilon _i \le 2^{-\alpha }\). Since the following inequalities

$$(1-\epsilon _2)a_2 \ge (1-2^{-\alpha })\cdot \frac{2^{-\alpha }}{1-2^{-\alpha }}\cdot ca_1 \ge c \cdot \epsilon _1a_1 \text {, and}$$
$$(1-\epsilon _2)a_2 >(1-\epsilon _2)c_2a_3 \ge ca_3 \ge c\cdot (1-\epsilon _j)a_j \text { for } 3\le j \le n$$

hold, the output \(m_2\) satisfies \((1 -2^{-\alpha })^2 a_2 \le m_2 \le a_2\) by Theorem 5.

Inductively, assume that we have obtained \(m_1,m_2,...,m_{j-1}\) satisfying the statement condition. After obtaining an approximate value \(m_{j-1}\) of the \((j-1)^\text {th}\) maximum value \(a_{j-1}\), the next input of \(\texttt {MaxIdx}\) algorithm is \((\delta _1a_1, \delta _2a_2,...,\delta _n a_n)\) where \(0 \le \delta _i \le 2^{-\alpha }\) for \(i < j\) and \((1-2^{-\alpha })^j \le \delta _i \le 1\) for otherwise. From the following inequalities

$$\delta _ja_j \ge (1-2^{-\alpha })^j\cdot \frac{2^{-\alpha }}{(1-2^{-\alpha })^j}\cdot ca_1 \ge c \cdot \delta _ia_i \text { for } 1 \le i < j \text {, and}$$
$$\delta _ja_j>\delta _jc_ja_{j+1} \ge ca_{j+1} \ge c\cdot \delta _ia_i \text { for } i > j,$$

by Theorem 5 the output \(m_{j+1}\) satisfies \((1-2^{-\alpha })\delta _ja_j \le m_j \le \delta _ja_j\) so that the statement also holds for j. Therefore, the theorem is proved by induction.    \(\square \)

Rights and permissions

Reprints and permissions

Copyright information

© 2019 International Association for Cryptologic Research

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Cheon, J.H., Kim, D., Kim, D., Lee, H.H., Lee, K. (2019). Numerical Method for Comparison on Homomorphically Encrypted Numbers. In: Galbraith, S., Moriai, S. (eds) Advances in Cryptology – ASIACRYPT 2019. ASIACRYPT 2019. Lecture Notes in Computer Science(), vol 11922. Springer, Cham. https://doi.org/10.1007/978-3-030-34621-8_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-34621-8_15

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-34620-1

  • Online ISBN: 978-3-030-34621-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics