fixed

2011/9/30 juaninf <juan...@gmail.com>

> Hi everybody,
>
> I want implement a modified extend Euclidean Algorithm, (egcd
> function), but this give wrong results, below my egcd, please help me
> to fix ...
> 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)
>
> --
> 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
>



-- 
---------------------------------------------------------------------
Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
---------------------------------------------------------------------

-- 
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