Hi everybody,

I want implement a extend Euclidean Algorithm ( to solve a(x)
congruence b(x)R(x) mod (g(x))), (egcd
function), but this give wrong results, below my egcd, please help me
to fix ...
I am testing with inverse multiplicative from output of xgcd
def egcd(p1,p2):
   if p2 == PR(0):
       return (p1,1,0)
   else:
       (q1, r1) = (p1).quo_rem(p2)
       (d,s1,t1) = egcd(p2, r1)
       return (d,t1,(s1 - q1 * t1))
m = 4
F.<x> = GF(2)
Phi.<x> = GF(2^m);
PR = PolynomialRing(Phi,'z');
N = 2^m - 1;
X = PolynomialRing(Phi,repr('z')).gen();
g = X^4+X^3+X^2+1+x^2; # goppa polynomial
R = (x^3 + x^2 + 1)*X^3 + (x^3 + x^2 + x)*X^2 + (x^2 + 1)*X + x^3 + x
(a11,b11,c11) = egcd(g,R)
print 'testing',((c11.mod(g)*(R))).mod(g)
(a11,b11,c11) = xgcd(g,R)
print 'testing',((c11.mod(g)*(R))).mod(g)

On 29 sep, 07:54, juaninf <juan...@gmail.com> wrote:
> in the paper that I reading say use Euclides Algorithm, but I dont
> know how
>
> On 29 sep, 07:29, juaninf <juan...@gmail.com> wrote:
>
>
>
>
>
>
>
> > g(x) is prime polynomial
>
> > On 29 sep, 07:28, juaninf <juan...@gmail.com> wrote:
>
> > > How do a(x) congruence b(x)R(x) mod (g(x)) in sage?
>
> > > thanks by your answers

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to