Positional Characteristics for Efficient Number Comparison over the Homomorphic Encryption


Modern algorithms for symmetric and asymmetric encryptions are not suitable to provide security of data that needs data processing. They cannot perform calculations over encrypted data without first decrypting it when risks are high. Residue Number System (RNS) as a homomorphic encryption allows ensuring the confidentiality of the stored information and performing calculations over encrypted data without preliminary decoding but with unacceptable time and resource consumption. An important operation for encrypted data processing is a number comparison. In RNS, it consists of two steps: the computation of the positional characteristic of the number in RNS representation and comparison of its positional characteristics in the positional number system. In this paper, we propose a new efficient method to compute the positional characteristic based on the approximate method. The approximate method as a tool to compare numbers does not require resource-consuming non-modular operations that are replaced by fast bit right shift operations and taking the least significant bits. We prove that in case when the dynamic range of RNS is an odd number, the size of the operands is reduced by the size of the module. If one of the RNS moduli is a power of two, then the size of the operands is less than the dynamic range. We simulate proposed method in the ISE Design Suite environment on the FPGA Xilinx Spartan-6 SP605 and show that it gains 31% in time and 37% in the area on average with respect to the known approximate method. It makes our method efficient for hardware implementation of cryptographic primitives constructed over a prime finite field.

This is a preview of subscription content, access via your institution.

Fig. 1.
Fig. 2.


  1. 1

    Massobrio, R., Nesmachnow, S., Tchernykh, A., Avetisyan, A., and Radchenko, G., Towards a cloud computing paradigm for big data analysis in smart cities, Program. Comput. Software, 2018, vol. 44, no. 3, pp. 181–189.

    Article  Google Scholar 

  2. 2

    Varnovskiy, N.P., Martishin, S.A., Khrapchenko, M.V., and Shokurov, A.V., Secure cloud computing based on threshold homomorphic encryption, Program. Comput. Software, 2015, vol. 41, no. 4, pp. 215–218.

    MathSciNet  Article  Google Scholar 

  3. 3

    Chang, C.H., Molahosseini, A.S., Zarandi, A.A.E., and Tay, T.F., Residue number systems: a new paradigm to datapath optimization for low-power and high-performance digital signal processing applications, IEEE Circuits Syst. Mag., 2015, vol. 15, no. 4, pp. 26–44.

    Article  Google Scholar 

  4. 4

    Chervyakov, N., Babenko, M., Tchernykh, A., Kucherov, N., Miranda-López, V., and Cortés-Mendoza, J.M., AR-RRNS: configurable reliable distributed data storage systems for Internet of things to ensure security, Future Gener. Comput. Syst., 2019, vol. 92, pp. 1080–1092. https://doi.org/10.1016/j.future.2017.09.061

    Article  Google Scholar 

  5. 5

    Sousa, L., Antao, S., and Martins, P., Combining residue arithmetic to design efficient cryptographic circuits and systems, IEEE Circuits Syst. Mag., 2016, vol. 16, no. 4, pp. 6–32.

    Article  Google Scholar 

  6. 6

    Chervyakov, N.I., Lyakhov, P.A., and Babenko, M., Digital filtering of images in a residue number system using finite-field wavelets, Autom. Control Comput. Sci., 2014, vol. 48, no. 3, pp. 180–189.

    Article  Google Scholar 

  7. 7

    Ye, R., Boukerche, A., Wang, H., Zhou, X., and Yan, B., RESIDENT: a reliable residue number system-based data transmission mechanism for wireless sensor networks, Wireless Networks, 2018, vol. 24, no. 2, pp. 597–610.

    Article  Google Scholar 

  8. 8

    Tchernykh, A., Schwiegelsohn, U., Talbi, E.G., and Babenko, M., Towards understanding uncertainty in cloud computing with risks of confidentiality, integrity, and availability, J. Comput. Sci., 2019, vol. 36, p. 100581.

    Article  Google Scholar 

  9. 9

    Miranda-López, V., Tchernykh, A., Cortés-Mendoza, J.M., Babenko, M., G. Radchenko, Nesmachnow, S., and Du, Z., Experimental analysis of secret sharing schemes for cloud storage based on RNS, Proc. Latin American High Performance Computing Conf., Buenos Aires, 2017, pp. 370–383.

  10. 10

    Tchernykh, A., Babenko, M., Chervyakov, N., Cortés-Mendoza, J.M., Kucherov, N., Miranda-López, V., Deryabin, M., Dvoryaninova, I., and Radchenko, G., Towards mitigating uncertainty of data security breaches and collusion in cloud computing, Proc. 28th Int. Workshop on Database and Expert Systems Applications (DEXA), Lyon, 2017, pp. 137–141.

  11. 11

    Babenko, M., Chervyakov, N., Tchernykh, A., Kucherov, N., Shabalina, M., Vashchenko, I., Radchenko, G., and Murga, D., Unfairness correction in P2P grids based on residue number system of a special form, Proc. 28th Int. Workshop on Database and Expert Systems Applications (DEXA), Lyon, 2017, pp. 147–151.

  12. 12

    Szabo, N.S. and Tanaka, R.I., Residue Arithmetic and Its Applications to Computer Technology, New York: McGraw-Hill, 1967.

    Google Scholar 

  13. 13

    Bi, S. and Gross, W.J., The mixed-radix Chinese remainder theorem and its applications to residue comparison, IEEE Trans. Comput., 2008, vol. 57, no. 12), 1624–1632.

  14. 14

    Wang, Y., Residue-to-binary converters based on new Chinese remainder theorems, IEEE Trans. Circuits Syst., 2000, vol. 47, no. 3, pp. 197–205.

    Article  Google Scholar 

  15. 15

    Dimauro, G., Impedovo, S., and Pirlo, G., A new technique for fast number comparison in the residue number system, IEEE Trans. Comput., 1993, vol. 42, no. 5, pp. 608–612.

    MathSciNet  Article  Google Scholar 

  16. 16

    Burgess, N., Scaling an RNS number using the core function, Proc. 16th IEEE Symp. on Computer Arithmetic, Santiago de Compostela, 2003, pp. 262–269.

  17. 17

    Dimauro, G., Impedovo, S., Modugno, R., Pirlo, G., and Stefanelli, R., Residue-to-binary conversion by the “quotient function”, IEEE Trans. Circuits Syst., 2003, vol. 50, no. 8, pp. 488–493.

    Article  Google Scholar 

  18. 18

    Pirlo, G. and Impedovo, D., A new class of monotone functions of the residue number system, Int. J. Math. Models Methods Appl. Sci., 2013, vol. 7, no. 9, pp. 803–809.

    Google Scholar 

  19. 19

    Chervyakov, N.I., Molahosseini, A.S., Lyakhov, P.A., Babenko, M.G., and Deryabin, M.A., Residue-to-binary conversion for general moduli sets based on approximate Chinese remainder theorem, Int. J. Comput. Math., 2017, vol. 94, no. 9, pp. 1833–1849.

    Article  Google Scholar 

  20. 20

    Patronik, P. and Piestrak, S.J., Design of reverse converters for general RNS moduli sets {2k, 2n – 1, 2n + 1, 2n + 1 – 1} and {2k, 2n – 1, 2n + 1, 2n – 1 – 1} (n even), IEEE Trans. Circuits Syst., 2014, vol. 61, no. 6, pp. 1687–1700.

    Article  Google Scholar 

  21. 21

    Phatak, D.S. and Houston, S.D., New distributed algorithms for fast sign detection in residue number systems (RNS), J. Parallel Distrib. Comput., 2016, vol. 97, pp. 78–95.

    Article  Google Scholar 

  22. 22

    Akushskii, I.Ya. and Yuditskii, D.I., Mashinnaya arifmetika v ostatochnykh protsessakh (Machine Arithmetic in Residual Classes), Moscow: Sovetskoe Radio, 1968.

  23. 23

    Omondi, A.R. and Premkumar, B., Residue Number Systems: Theory and Implementation, London: Imperial College Press, 2007.

    Google Scholar 

  24. 24

    Isupov, K., “An algorithm for magnitude comparison in RNS based on mixed-radix conversion II, Int. J. Comput. Appl., 2016, vol. 141, no. 5.

  25. 25

    Van Vu, T., Efficient implementations of the Chinese remainder theorem for sign detection and residue decoding, IEEE Trans. Comput., 1985, vol. 100, no. 7, pp. 646–651.

    Article  Google Scholar 

  26. 26

    Mohan, P.A., RNS to binary conversion using diagonal function and Pirlo and Impedovo monotonic function, Circuits, Syst., Signal Process., 2016, vol. 35, no. 3, pp. 1063–1076.

    MathSciNet  Article  Google Scholar 

  27. 27

    Tchernykh, A., Babenko, M., Chervyakov, N., Miranda-López, V., Kuchukov, V., Cortés-Mendoza, J.M., Deryabin, M., Kucherov, N., Radchenko, G., and Avetisyan, A., AC-RRNS: anti-collusion secured data sharing scheme for cloud storage, Int. J. Approx. Reason., 2018, vol. 102, pp. 60–73.

    MathSciNet  Article  Google Scholar 

Download references


The work is partially supported by Russian Foundation for Basic Research (RFBR) 18-07-00109, 18-07-01224, and 19-07-00856, State task nos. 2.6035.2017 and 2019-1105, Russian Federation President Grant MK-341.2019.9, and SP-2236.2018.5.

Author information



Corresponding authors

Correspondence to M. Babenko or A. Tchernykh or N. Chervyakov or V. Kuchukov or V. Miranda-López or R. Rivera-Rodriguez or Z. Du or E.-G. Talbi.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Babenko, M., Tchernykh, A., Chervyakov, N. et al. Positional Characteristics for Efficient Number Comparison over the Homomorphic Encryption. Program Comput Soft 45, 532–543 (2019). https://doi.org/10.1134/S0361768819080115

Download citation