我正在寻找一种算法(或代码)来帮助我计算多项式的逆,我需要它来实现NTRUEncrypt。我更喜欢一种容易理解的算法,有伪代码可以做到这一点,但它们令人困惑,很难实现,而且我不能真正理解伪代码的过程。
计算多项式关于ring of truncated polynomials的逆的任何算法
发布于 2010-03-12 00:01:10
我在拥有NTRU的安全创新公司工作,所以我很高兴看到这种兴趣。
IEEE标准1363.1-2008规定了如何使用最新的参数集实现NTRUEncrypt。它给出了求逆多项式的以下规范:
部门:
输入是a和b,两个多项式,其中b是N-1次,b_N是b的前导系数。输出是q和r,使得a= q*b +r且deg(r) < deg(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中求逆,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-04-18:感谢Sonel Sharam发现了以前版本中的一些错误)
https://stackoverflow.com/questions/2421409
复制相似问题