algos_sig: added H=20 fmtseq variant

...that provide around 1 million signatures per key. That seems more
than sufficient for human usage.

Note that generating the key takes 16 times longer than for already
present algorithms (that have H=16). On my computer, it is around 4
minutes for fmtseq128N20 and 16 minutes for fmtseq256N20.
This commit is contained in:
Mirek Kratochvil 2013-05-25 19:19:22 +02:00
parent 0980ee827a
commit b5ae7ca4dd
3 changed files with 189 additions and 17 deletions

View file

@ -23,21 +23,15 @@
void fill_algorithm_suite (algorithm_suite&s)
{
static algo_mceqd128 mce128;
mce128.register_into_suite (s);
static algo_mceqd192 mce192;
mce192.register_into_suite (s);
static algo_mceqd256 mce256;
mce256.register_into_suite (s);
static algo_fmtseq128 fmt128;
fmt128.register_into_suite (s);
static algo_fmtseq192 fmt192;
fmt192.register_into_suite (s);
static algo_fmtseq256 fmt256;
fmt256.register_into_suite (s);
#define do_alg(x) static x var_##x ; var_##x.register_into_suite(s);
do_alg (algo_mceqd128);
do_alg (algo_mceqd192);
do_alg (algo_mceqd256);
do_alg (algo_fmtseq128);
do_alg (algo_fmtseq192);
do_alg (algo_fmtseq256);
do_alg (algo_fmtseq128h20);
do_alg (algo_fmtseq192h20);
do_alg (algo_fmtseq256h20);
#undef do_alg
}

View file

@ -270,3 +270,115 @@ int algo_fmtseq256::create_keypair (sencode**pub, sencode**priv, prng&rng)
return 0;
}
/*
* h=20 variants for signature count 1048576.
*
* Chosen were parameters h=4,l=5 over the h=5,l=4 variant for smaller runtime
* space needed, as signature time is not really a concern here.
*/
int algo_fmtseq128h20::sign (const bvector&msg,
bvector&sig,
sencode**privkey,
bool&dirty,
prng&rng)
{
return fmtseq_generic_sign
<4, 5, 256, sha256hash, rmd128hash>
(msg, sig, privkey, dirty, rng);
}
int algo_fmtseq128h20::verify (const bvector&sig,
const bvector&msg,
sencode*pubkey)
{
return fmtseq_generic_verify
<4, 5, 256, sha256hash, rmd128hash>
(sig, msg, pubkey);
}
int algo_fmtseq192h20::sign (const bvector&msg,
bvector&sig,
sencode**privkey,
bool&dirty,
prng&rng)
{
return fmtseq_generic_sign
<4, 5, 384, sha384hash, tiger192hash>
(msg, sig, privkey, dirty, rng);
}
int algo_fmtseq192h20::verify (const bvector&sig,
const bvector&msg,
sencode*pubkey)
{
return fmtseq_generic_verify
<4, 5, 384, sha384hash, tiger192hash>
(sig, msg, pubkey);
}
int algo_fmtseq256h20::sign (const bvector&msg,
bvector&sig,
sencode**privkey,
bool&dirty,
prng&rng)
{
return fmtseq_generic_sign
<4, 5, 512, sha512hash, sha256hash>
(msg, sig, privkey, dirty, rng);
}
int algo_fmtseq256h20::verify (const bvector&sig,
const bvector&msg,
sencode*pubkey)
{
return fmtseq_generic_verify
<4, 5, 512, sha512hash, sha256hash>
(sig, msg, pubkey);
}
int algo_fmtseq128h20::create_keypair (sencode**pub, sencode**priv, prng&rng)
{
fmtseq::pubkey Pub;
fmtseq::privkey Priv;
rmd128hash hf;
if (fmtseq::generate (Pub, Priv, rng, hf, 256, 4, 5) )
return 1;
*pub = Pub.serialize();
*priv = Priv.serialize();
return 0;
}
int algo_fmtseq192h20::create_keypair (sencode**pub, sencode**priv, prng&rng)
{
fmtseq::pubkey Pub;
fmtseq::privkey Priv;
tiger192hash hf;
if (fmtseq::generate (Pub, Priv, rng, hf, 384, 4, 5) )
return 1;
*pub = Pub.serialize();
*priv = Priv.serialize();
return 0;
}
int algo_fmtseq256h20::create_keypair (sencode**pub, sencode**priv, prng&rng)
{
fmtseq::pubkey Pub;
fmtseq::privkey Priv;
sha256hash hf;
if (fmtseq::generate (Pub, Priv, rng, hf, 512, 4, 5) )
return 1;
*pub = Pub.serialize();
*priv = Priv.serialize();
return 0;
}

View file

@ -87,5 +87,71 @@ public:
int create_keypair (sencode**pub, sencode**priv, prng&rng);
};
class algo_fmtseq128h20 : public algorithm
{
public:
bool provides_signatures() {
return true;
}
bool provides_encryption() {
return false;
}
std::string get_alg_id() {
return "FMTSEQ128H20-SHA256-RIPEMD128";
}
virtual int sign (const bvector&msg, bvector&sig,
sencode** privkey, bool&dirty, prng&rng);
virtual int verify (const bvector&sig, const bvector&msg,
sencode* pubkey);
int create_keypair (sencode**pub, sencode**priv, prng&rng);
};
class algo_fmtseq192h20 : public algorithm
{
public:
bool provides_signatures() {
return true;
}
bool provides_encryption() {
return false;
}
std::string get_alg_id() {
return "FMTSEQ192H20-SHA384-TIGER192";
}
virtual int sign (const bvector&msg, bvector&sig,
sencode** privkey, bool&dirty, prng&rng);
virtual int verify (const bvector&sig, const bvector&msg,
sencode* pubkey);
int create_keypair (sencode**pub, sencode**priv, prng&rng);
};
class algo_fmtseq256h20 : public algorithm
{
public:
bool provides_signatures() {
return true;
}
bool provides_encryption() {
return false;
}
std::string get_alg_id() {
return "FMTSEQ256H20-SHA512-SHA256";
}
virtual int sign (const bvector&msg, bvector&sig,
sencode** privkey, bool&dirty, prng&rng);
virtual int verify (const bvector&sig, const bvector&msg,
sencode* pubkey);
int create_keypair (sencode**pub, sencode**priv, prng&rng);
};
#endif