I need to implement the Cyptosystem NTRU public key as part of my university project last year. I am trying to implement an algorithm that multiplies long polynomials through recursion, however I am pretty bogged down in an attempt to understand the pseudocode.
Algorithm PolyMult(c, b, a, n, N) Require: N, n, and the polynomial operands, b and c. PolyMult returns the product polynomial a through the argument list PolyMult(a,b,c,n,N) { 1. if(...) 2. { 3. ... 4. ... 5. ... 6. ... 7. } 8. else 9. { 10. n1 = n/2; 11. n2 = n-n1; 12. b = b1+b2*X^(n1); 13. c = c1+c2*X^(n1); 14. B = b1+b2; 15. C = c1+c2; 16. PolyMult(a1,b1,c1,n1,N);
Note that N, n, n1 and n2 are all int types. a, a1, a2, b, b1, b2, c, c1, c2, B, C are all polynomials and are presented as arrays.
On lines 16, 17 and 18, the PolyMult function is called with arguments a1, b1, c1, n1, N, then a2, b2, c2, n2, N and finally a3, B, C, n2, N, respectively, I initialized the arrays a1, b1, c1 before line 16, then pass them to PolyMult (recursion starts here!) and returns the response and save it in some temporary array, for example, I implement line 16 as follows:
int z[] = PolyMult(a1,b1,c1,n1,N);
Now my question : when the polynomial stored in the z [] array is used again in the program, I see no indication that it will be used again from the pseudo-code, but if array z [] is not used again in the program, what is the point of line 16 and recursion all together? How to implement lines 16-18?
So, we repeat, when and how will the polynomial stored in the z array be used again in the program? And how should I use lines 16-18?
For more information, a full description of the pseudocode can be found on page 3 of this article: http://www.ntru.com/cryptolab/pdf/NTRUTech010.pdf .