These 2 functions perform the Extended Euclidean Algorithm, and then find the multiplicative inverse. The order seems to be correct, but it does not return with what I expect from U of Sydney on this tool http://magma.maths.usyd.edu.au/calc/ , and since this is done in GF (2), the final field , I think I missed some key step that translates from base 10 to this field.
This has been tested and processed based on 10, but taking polynomials with binary coefficients with them may not be possible. Therefore, my question is which parts of Python I incorrectly apply to this algorithm, for example // floor, which can carry on the fact that a function in base 10 could be able to do this in GF (2).
The tool above can be tested as follows:
R<x>:=PolynomialRing(GF(2)); p:=x^13+x+1; q:=x^12+x; g,r,s:=XGCD(p,q); g eq r*p+s*q; g,r,s;
Functions:
def extendedEuclideanGF2(self,a,b):
I tested such polynomials, but in binary form:
p = "x**13 + x**1 + x**0" q = "x**12 + x**1"
source share