A-14.1 Application: Residue Number System (RNS)

In a modern processor, each data size is a maximum of 64 bits. If the data size exceeds 64 bits, its computations can be handled efficiently by using the Chinese remainder theorem, ensuring that each co-prime modulus ni satisfies log⁡2ni ≤64 (where N = n0 ⋅n1⋯ ⋅nk), so that we can represent a large value a mod N as a→𝑐𝑟𝑡 = (a0,a1,⋯,ak), where a ≡ai mod ni. Then, for any pair of big numbers a and b mod N, we can compute a + b mod N and a ⋅b mod N as follows:

Thus, the Chinese remainder theorem gives us the following useful formula:

⟨Theorem A-14.2⟩ Application of the Chinese Remainder Theorem

Suppose there are two big numbers a = ∑ ⁡ i=0kaiyizi mod N and b = ∑ ⁡ i=0kbiyizi mod N where N is a the product of co-prime moduli n0 ⋅n1⋯nk, we have an isomorphism as follows:

a →σa→𝑐𝑟𝑡 = (a0,a1,⋯,ak)

b →σb→𝑐𝑟𝑡 = (b0,b1,⋯,bk)

Based on the above isomorphism, the following is true:

, where each element-wise addition/multiplication can be independently done modulo ni