fixes
This commit is contained in:
parent
0b4a55d235
commit
985c71e831
|
@ -34,7 +34,8 @@ bool bvector::zero() const
|
|||
void bvector::to_poly (polynomial&r, gf2m&fld)
|
||||
{
|
||||
r.clear();
|
||||
r.resize ( (size() % fld.m) ? 1 : 0 + (size() / fld.m), 0);
|
||||
if(size() % fld.m) return; //impossible
|
||||
r.resize (size() / fld.m, 0);
|
||||
for (uint i = 0; i < size(); ++i)
|
||||
if (item (i) ) r[i/fld.m] |= 1 << (i % fld.m);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ void syndrome_decode (bvector&syndrome, gf2m&fld, polynomial& goppa,
|
|||
std::vector<polynomial>& sqInv, bvector&ev)
|
||||
|
||||
{
|
||||
ev.clear();
|
||||
ev.resize (fld.n, 0);
|
||||
if (syndrome.zero() ) return;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ int privkey::decrypt (const bvector&in, bvector&out)
|
|||
not_permuted.resize (Sinv.size() );
|
||||
|
||||
//unscramble the result
|
||||
Sinv.mult_vec_right (not_permuted, out);
|
||||
Sinv.mult_vecT_left (not_permuted, out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -244,8 +244,9 @@ void polynomial::compute_goppa_check_matrix (matrix&r, gf2m&fld)
|
|||
//multiply by goppa coefficients (compute t*vd)
|
||||
h.resize (fld.n);
|
||||
for (i = 0; i < fld.n; ++i) {
|
||||
h[i].resize (t, 0);
|
||||
for (j = 0; j < t; ++j) //computing the element h[i][j]
|
||||
h[i].resize (t);
|
||||
for (j = 0; j < t; ++j) { //computing the element h[i][j]
|
||||
h[i][j]=0;
|
||||
for (k = 0; k <= j; ++k) //k = column index of t
|
||||
h[i][j] = fld.add (h[i][j],
|
||||
fld.mult (item (t - j + k),
|
||||
|
@ -285,7 +286,7 @@ void polynomial::sqrt (vector<polynomial>& sqInv, gf2m&fld)
|
|||
{
|
||||
polynomial a = *this;
|
||||
clear();
|
||||
uint s=sqInv.size();
|
||||
uint s = sqInv.size();
|
||||
resize (s, 0);
|
||||
|
||||
for (uint i = 0; i < s; ++i) {
|
||||
|
|
Loading…
Reference in a new issue