mce_qd: debug
This commit is contained in:
parent
09538f45d8
commit
63e3e591b6
|
@ -66,17 +66,19 @@ void bvector::to_poly_cotrace (polynomial&r, gf2m&fld)
|
||||||
{
|
{
|
||||||
r.clear();
|
r.clear();
|
||||||
if (size() % fld.m) return; //impossible
|
if (size() % fld.m) return; //impossible
|
||||||
r.resize (size() / fld.m, 0);
|
uint s=size()/fld.m;
|
||||||
|
r.resize (s, 0);
|
||||||
for (uint i = 0; i < size(); ++i)
|
for (uint i = 0; i < size(); ++i)
|
||||||
if (item (i) ) r[i%fld.m] |= (1 << (i / fld.m) );
|
if (item (i) ) r[i%s] |= (1 << (i/s) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void bvector::from_poly_cotrace (const polynomial&r, gf2m&fld)
|
void bvector::from_poly_cotrace (const polynomial&r, gf2m&fld)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
resize (r.size() *fld.m, 0);
|
uint s=r.size();
|
||||||
|
resize (s*fld.m, 0);
|
||||||
for (uint i = 0; i < size(); ++i)
|
for (uint i = 0; i < size(); ++i)
|
||||||
item (i) = (r[i%fld.m] >> (i / fld.m) ) & 1;
|
item (i) = (r[i%s] >> (i/s) ) & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -90,7 +90,6 @@ int mce_qd::generate (pubkey&pub, privkey&priv, prng&rng,
|
||||||
//compute the support, retry if it has two equal elements.
|
//compute the support, retry if it has two equal elements.
|
||||||
used.clear();
|
used.clear();
|
||||||
bool consistent = true;
|
bool consistent = true;
|
||||||
used.insert (0); //zero is forbidden
|
|
||||||
for (uint i = 0; i < fld.n / 2; ++i) {
|
for (uint i = 0; i < fld.n / 2; ++i) {
|
||||||
support[i] = fld.add (
|
support[i] = fld.add (
|
||||||
fld.inv (Hsig[i]),
|
fld.inv (Hsig[i]),
|
||||||
|
@ -121,7 +120,7 @@ int mce_qd::generate (pubkey&pub, privkey&priv, prng&rng,
|
||||||
|
|
||||||
//assemble blocks to bl
|
//assemble blocks to bl
|
||||||
std::vector<std::vector<uint> > bl, blp;
|
std::vector<std::vector<uint> > bl, blp;
|
||||||
bl.resize (block_size);
|
bl.resize (h_block_count);
|
||||||
for (uint i = 0; i < h_block_count; ++i)
|
for (uint i = 0; i < h_block_count; ++i)
|
||||||
bl[i] = std::vector<uint>
|
bl[i] = std::vector<uint>
|
||||||
(Hsig.begin() + i * block_size,
|
(Hsig.begin() + i * block_size,
|
||||||
|
@ -174,6 +173,7 @@ int mce_qd::generate (pubkey&pub, privkey&priv, prng&rng,
|
||||||
continue; //retry with other hperm
|
continue; //retry with other hperm
|
||||||
Hc.strip_right_square (l);
|
Hc.strip_right_square (l);
|
||||||
ri.mult (l);
|
ri.mult (l);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue