From 63e3e591b65b49b0d60f973a2ba8991d483d2a86 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sun, 30 Sep 2012 17:29:42 +0200 Subject: [PATCH] mce_qd: debug --- lib/bvector.cpp | 10 ++++++---- lib/mce_qd.cpp | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/bvector.cpp b/lib/bvector.cpp index 2f27f7d..36da30b 100644 --- a/lib/bvector.cpp +++ b/lib/bvector.cpp @@ -66,17 +66,19 @@ void bvector::to_poly_cotrace (polynomial&r, gf2m&fld) { r.clear(); 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) - 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) { clear(); - resize (r.size() *fld.m, 0); + uint s=r.size(); + resize (s*fld.m, 0); 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; } /* diff --git a/lib/mce_qd.cpp b/lib/mce_qd.cpp index aba93b7..33429b4 100644 --- a/lib/mce_qd.cpp +++ b/lib/mce_qd.cpp @@ -90,7 +90,6 @@ int mce_qd::generate (pubkey&pub, privkey&priv, prng&rng, //compute the support, retry if it has two equal elements. used.clear(); bool consistent = true; - used.insert (0); //zero is forbidden for (uint i = 0; i < fld.n / 2; ++i) { support[i] = fld.add ( fld.inv (Hsig[i]), @@ -121,7 +120,7 @@ int mce_qd::generate (pubkey&pub, privkey&priv, prng&rng, //assemble blocks to bl std::vector > bl, blp; - bl.resize (block_size); + bl.resize (h_block_count); for (uint i = 0; i < h_block_count; ++i) bl[i] = std::vector (Hsig.begin() + i * block_size, @@ -174,6 +173,7 @@ int mce_qd::generate (pubkey&pub, privkey&priv, prng&rng, continue; //retry with other hperm Hc.strip_right_square (l); ri.mult (l); + break; } /*