1. 引言
Yuval Domb 2022年论文《Fast Modular Multiplication》
模乘可以说是任何密码系统中计算量最大的算术原语。本文提出了一种高效、硬件友好的算法,据作者所知,该算法优于迄今为止的算法。
标准的modulo-prime multiplication problem in F s \mathbb{F}_s Fs表示为:
r = a ⋅ b m o d s \begin{equation} r=a\cdot b \mod s \end{equation} r=a⋅bmods
其中 a , b , s ∈ F s a,b,s\in\mathbb{F}_s a,b,s∈Fs, s s s为素数,并利用标准 Z \mathbb{Z} Z-algebra。
等价为:
a ⋅ b = l ⋅ s + r \begin{equation} a\cdot b = l\cdot s +r \end{equation} a⋅b=l⋅s+r
其中, l ∈ Z l\in \mathbb{Z} l∈Z,使得 0 ≤ r < s 0\leq r < s 0≤r<s。
本文主要为(1)中计算提供了一种高效、硬件友好的快速计算方法。
将所有变量以 d d d-进制来表示,其中 F s \mathbb{F}_s Fs内的每个元素都以 n n n个digits来表示,有:
n = ⌈ log d s ⌉ \begin{equation} n=\left \lceil \log _ds\right \rceil \end{equation} n=⌈logds⌉
接下来,简单地令 d = 2 d=2 d=2,所有元素以二进制来表示。
尽管本文重点关注modulo-prime multiplication,但可将其推广到任意 a m o d s a\mod s amods运算,其中 a < s 2 a<s^2 a<s2, s s s可为素数或非素数的任意值。
2. 本文主要贡献
本文主要展现了,如何将:
- Barrett Reduction算法(具体见Barrett 1987年论文《Implementing the rivest shamir and adleman public key encryption algorithm on a standard digital signal processor》)
- 与 好的参数选择
- 以及 简单的bounding技术
结合,用于求取quotient l l l的近似值,近视精度为一个小的constant error,该constant error与 n n n无关(无论 n n n值大小)。
令人惊讶的是,最终的reduction算法与Montgomery的Modular-Multiplication算法(见Montgomery 1985年论文《 Modular multiplication without trial division》)类似,但是本文最终的reduction算法不需要coordinate translation。
本文的bounding技术可用于进一步降低特定感兴趣场景的计算复杂度(知识需要增加constant error),本文不展开。