Philippe de Rochambeau on Fri, 12 Nov 2021 15:29:51 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

pmult


Hello,
I’m trying to translate the below Cryptol (cf. https://cryptol.net/files/ProgrammingCryptol.pdf, p. 51) example to PariGP 

Multiplication in GF(2n) follows the usual polynomial multiplication algorithm, where we multiply the
first polynomial with each term of the second, and add all the partial sums (i.e., compute their exclusive-or). While
this operation can be programmed explicitly, Cryptol does provide the primitive pmult for this purpose:
Cryptol> pmult <| x^^3 + x^^2 + x + 1 |> <| x^^2 + x + 1 |>
45
Cryptol> <| x^^5 + x^^3 + x^^2 + 1 |>
45



? lift(Mod(2^8,  (x^3 + x^2 + x + 1) * (x^2 + x + 1)))
%94 = 256

? lift(Mod(2^5,  (x^3 + x^2 + x + 1) * (x^2 + x + 1)))
%95 = 32


How do you « add the partial sums by computing their exclusive-or » in PariGP, if such an operation is possible?

Any help would be much appreciated.

Cheers,

Philippe