more cleaniness

This commit is contained in:
Mirek Kratochvil 2012-05-15 22:09:19 +02:00
parent 78da95a2e8
commit b54fcb9bf3
3 changed files with 11 additions and 11 deletions

View file

@ -72,6 +72,7 @@ int privkey::decrypt (const bvector&in, bvector&out)
//prepare for decoding //prepare for decoding
permutation hpermInv; permutation hpermInv;
hperm.compute_inversion (hpermInv); hperm.compute_inversion (hpermInv);
bvector canonical, syndrome; bvector canonical, syndrome;
hpermInv.permute (not_permuted, canonical); hpermInv.permute (not_permuted, canonical);
h.mult_vec_right (canonical, syndrome); h.mult_vec_right (canonical, syndrome);
@ -80,8 +81,7 @@ int privkey::decrypt (const bvector&in, bvector&out)
bvector ev; bvector ev;
syndrome_decode (syndrome, fld, g, sqInv, ev); syndrome_decode (syndrome, fld, g, sqInv, ev);
std::cout << "ERRORS " << ev; // check the error vector, it should have exactly t == deg (g) errors
//check the error vector. It should have exactly t == deg(g) errors
if ( (int) ev.hamming_weight() != g.degree() ) if ( (int) ev.hamming_weight() != g.degree() )
return 1; return 1;

View file

@ -39,7 +39,7 @@ int main()
cout << pub.G; cout << pub.G;
ccr::bvector plain; ccr::bvector plain;
plain.resize (pub.plain_size() ); plain.resize (pub.plain_size(), 0);
plain[0] = 1; plain[0] = 1;
plain[1] = 1; plain[1] = 1;
plain[2] = 1; plain[2] = 1;