Multiple approaches to Convert RNS to Decimal Numbers

Improving the performance and speed of encryption algorithms is an important issue in cryptography. One of these improvements is the use of the RNS system. In the research, the RNS system and how to retrieve numbers from the RNS system to WNS weight number system or (decimal number) where discussed in several ways, and after performing multiplication operations, giving illustrative examples and making comparisons between methods.


Introduction
The main goal of conducting development on technologies and algorithms is the speed in executing operations.It is one of the main requirements for the strength and quality of algorithms.As one of the things that speeds up the work of intensive calculations is the representation of numbers using RNS because of its property in simplifying integer numbers into simpler numbers that lead to the speed of calculations.RNS is considered one of the important systems with high effectiveness in improving the implementation of operations especially when used with encryption systems, because of its high speed in conducting operations and obtaining results in less time.This system (RNS) was proposed in [1].The addition and multiplication operations performed in this system have the same execution time, this is very useful, especially when using algorithms that need to deal with very large numbers, as in asymmetric encryption systems . Homomorphic Encryption is considered one of the encryption systems that RNS has helped in improving its performance and significantly increasing the speed of operations, because RNS has the ability to deal with numbers separately (parallel) [3].
Many researchers have studied the field of RNS and how it works and develops it through putting forward theories, proofs and researches that explain this system.Kuchukov, V. and et.al.[4] (2022), A summary of the techniques used to convert the positional number system from the RNS is provided.Reverse conversion techniques for moduli in general form, including the MRC, the CRT, and the Chinese residue theorem with fractional numbers.the authors' theories derived from reference points and modified mixed-radix conversion.The process of determining the residue of division by a large modulo can be substituted with the sequential computation of the residue in this instance, thanks to the modified approach based on the MRC.By changing the number of moduli of one method and the other, this methodology allows one to strike a balance between the hardware employed and the calculation time.The other research in [5] (2013), by Karim Bigou, and Arnaud Tisserand, a new RNS modular inversion technique, based on the plus-minus trick and the extended Euclidean algorithm, is described in the study.the technique replaces expensive computations modulo 4 with comparisons across big RNS values.the researchers made comparisons to an RNS version using Fermat's Little Theorem.achieve a 6-10 times quicker plus-minus RNS modular inversion, with a significant reduction in the amount of elementary modular operations.Where by Karl C. Posch and Reinhard Posch in [6] (2011), present a novel approach that combines RNS with effective modulo reduction techniques.the researchers compare two approaches and thoroughly examine the speedier one.The order of complexity for both approaches is O(log n), where n is the number of registers that are used.They also explain faster ways to multiply and retrieve numbers from RNS. Umar, A. F. [7] (2011), the issue of data conversion in the Residue Number System (RNS) is addressed in this thesis.This system is crucial for embedded CPUs, particularly those in portable devices, where power consumption is the most important design consideration.The goal of this thesis is to create effective methods for converting conventional representations to RNS representations and vice versa.give an overview of some of the conversion techniques and strategies that are currently in use when the signal has a binary form.Gbolagade, K. A., & Cotofana, S. D. [8] (2008), An important issue with using RNS numbers in Digital Signal Processing applications is the conversion of RNS operands to decimal, which the researchers looked into.They introduce an MRC method for effectively converting RNS to decimal, utilizing the moduli set {2n + 2, 2n + 1, 2n}, which shares a factor of 2. Because there is less labor involved in the computations, the multipliers and adders are less complicated.
In this research paper, in the second section, you talk about RNS.Followed by methods for returning numbers to their normal state in the third section.In the fourth section, it explains the procedure of multiplication in RNS and returning the result to a decimal number.

Residue Number System (RNS)
Integer ∈ℤ to represent in RNS with a set of pairwise coprime integer B={m1, m2,….,mn} and size n [1], [9].no repeat in all elements of base and must be relatively prime to each other (the GCD between them equal to 1).Represent  with RNS as ⟨⟩ B =⟨ 1 , … ,   ⟩ B where  1 =   1 Likewise for the rest.The condition to represent  must M>. = ⌈ l /w ⌉ where l number of bits represent x, and w number of bits for each x mod mi , and note that x mod mi = [x] m i , The product of all bases let M=∏    =1 , and always M>x. the Fig. 1, illustrate the architecture of RNS.

Fig. 1: architecture of RNS
The Fig. 1, explains the integer number divided into multiple small numbers (channels).
Example1: let =17 to represent it in RNS with bases B={3,5,7}, the GCD between all elements of B equivalent to 1, and M=105 , 0 ≤ x <M.Then the RNS of x: If two integers are found and want aplying mathematical operation such as addition or multiplication must represent integers in RNS, before performing operations and compute each channel independent from others.See Fig. 2 .

Conversion Decimal Number From RNS
To return the integers to their normal state from the RNS, there are several methods proposed by the researchers as follows:

Chinese Remainder Theorem (CRT)
The main method to convert integer represent in RNS is CRT, [9], [10].Many researchers based on CRT as the following formula: As mentioned earlier 0 ≤ x <M, where M=∏    =1 .

Approximation Method (AM)
AM is the fast function [ 13], [14] to calculate integer from RNS by use the flowing: Then from the coefficient's calculation found the values:

Diagonal Function (DF)
To calculate integer based on [15], [16] from RNS by using the formula: The number calculate by: x =

Retrieve the product of the multiplication from the RNS
To multiply two decimal numbers, each number must be represented by an RNS, and then the numbers are multiplied in a simple way, as in the following example: Example6: let x=12, and y=23, B= {5,7,11} (The base must be chosen so that M is higher than the product of the multiplication in order to retrieve the result correctly) where M=385 , M1=77 , M2=55 , M3=35 , M_1^(-1)=3 , M_2^(-1)=6 , M_3^(-1)=6.To retrieve the decimal number after multiplication from the RNS, it is summarized as in the following Table 1:

disadvantage
The calculation time increases as the number gets larger.require to more division [9], [10] Non-Reliability have many cases in solution [11], [12].
To compute large number must be use large M, then more time that' not good.If the complex operation or large number are found, can use more than one base.By using base extension (BE) to convert from one base to another base as the following algorithm1 [17], [18], [19].

Conclusion
An important improvement that allows for better speed and efficiency is the use of RNS transfers.When representing decimal numbers in such a system, need to return them to their natural state.To return numbers from RNS to decimal, there are several approaches to do this.There is a difference between each method and the other in terms of speed, smooth operations and the application in which it is used.However, the use of RNS remains specific and simple, and to expand its operations to deal with greater complexity, it is preferable to use BE to obtain greater speed.