算法用于计算多项式的逆
-
19-09-2019 - |
题
我在寻找一种算法(或者代码),以帮助我计算逆多项式,我需要它实现NTRUEncrypt。一种算法是容易理解的是我愿意的话,也有这样做的伪代码,但他们是混乱和难以实施,而且我不能真正理解单从伪代码的程序。
,用于相对于截短的多项式的环计算多项式的逆的任何算法
解决方案
我的安全创新,拥有NTRU工作,所以我很高兴看到这种兴趣。
IEEE标准1363.1-2008指定如何使用最新的参数集执行NTRUEncrypt。它提供了以下规格反转多项式:
司:
输入是A和B,两个多项式,其中b是度N-1和B_N为b的首项系数。输出是q和r,使得= Q * B + r和度(R)<度(B)。 R_D表示度d,即r的首项系数的系数r。
a) Set r := a and q := 0
b) Set u := (b_N)^–1 mod p
c) While deg r >= N do
1) Set d := deg r(X)
2) Set v := u × r_d × X^(d–N)
3) Set r := r – v × b
4) Set q := q + v
d) Return q, r
下面,R_D是度d的r的系数。
扩展欧几里得算法:
a) If b = 0 then return (1, 0, a)
b) Set u := 1
c) Set d := a
d) Set v1 := 0
e) Set v3 := b
f) While v3 ≠ 0 do
1) Use the division algorithm (6.3.3.1) to write d = v3 × q + t3 with deg t3 < deg v3
2) Set t1 := u – q × v1
3) Set u := v1
4) Set d := v3
5) Set v1 := t1
6) Set v3 := t3
g) Set v := (d – a × u)/b [This division is exact, i.e., the remainder is 0]
h) Return (u, v, d)
逆的Z_p,第一个素数:
a) Run the Extended Euclidean Algorithm with input a and (X^N – 1). Let (u, v, d) be the output, such that a × u + (X^N – 1) × v = d = GCD(a, (X^N – 1)).
b) If deg d = 0, return b = d^–1 (mod p) × u
c) Else return FALSE
逆的Z_p ^ E /(M(X)中,p素数,M(X)的合适的多项式如X ^ N-1
a) Use the Inversion Algorithmto compute a polynomial b(X) ε R[X] that gives an inverse of a(X) in (R/pR)[X]/(M(X)). Return FALSE if the inverse does not exist. [The Inversion Algorithm may be applied here because R/pR is a field, and so (R/pR)[X] is a Euclidean ring.]
b) Set n = p
c) While n <= e do
1) b(X) = p × b(X) – a(X) × b(X)^2 (mod M(X)), with coefficients computed modulo p^n
2) Set n = p × n
d) Return b(X) mod M(X) with coefficients computed modulo p^e.
如果你正在做一个全面实施NTRU的你应该看到,如果你能得到你的机构买入1363.1,为原料NTRU加密并不安全防范主动攻击和1363.1描述信息处理技术来解决这个问题。
(2013年4月18日更新:由于SONEL Sharam在先前版本斑点的一些错误)
不隶属于 StackOverflow