polynomial irreducibility test in GF2

This commit is contained in:
2024-01-01 10:58:30 +01:00
parent 1e00570f66
commit 9bceebdd29
5 changed files with 81 additions and 3 deletions

7
t.cc
View File

@@ -2949,12 +2949,19 @@ cout <<factorization(n)<<" phi = "<<eulerphi(n)<<endl;
if(1)
{
bitvector ir; cin >>ir;
if(!ir.is_irreducible()) laerror("input must be an irreducible polynomial");
bitvector a; cin >>a;
bitvector ai = a.field_inv(ir);
cout<< "inverse = "<<ai<<endl;
cout<<"check1 " <<(a*ai)%ir<<endl;
cout<<"check2 " <<a.field_mult(ai,ir)<<endl;
bitvector c=a.composition(ai);
bitvector cc=a.field_composition(ai,ir);
cout <<c<<endl;
cout <<c%ir<<endl;
cout <<cc<<endl;
}