algos_enc: mceqd192 variant to match fmtseq192

This commit is contained in:
Mirek Kratochvil 2013-05-01 16:44:31 +02:00
parent 24bd5bd185
commit 1553c09d20
3 changed files with 60 additions and 1 deletions

View file

@ -23,10 +23,12 @@
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);

View file

@ -37,6 +37,19 @@ int algo_mceqd128::create_keypair (sencode**pub, sencode**priv, prng&rng)
return 0;
}
int algo_mceqd192::create_keypair (sencode**pub, sencode**priv, prng&rng)
{
mce_qd::pubkey Pub;
mce_qd::privkey Priv;
if (mce_qd::generate (Pub, Priv, rng, 16, 8, 27, 4) )
return 1;
*pub = Pub.serialize();
*priv = Priv.serialize();
return 0;
}
int algo_mceqd256::create_keypair (sencode**pub, sencode**priv, prng&rng)
{
mce_qd::pubkey Pub;
@ -377,6 +390,17 @@ int algo_mceqd128::encrypt (const bvector&plain, bvector&cipher,
(plain, cipher, pubkey, rng);
}
int algo_mceqd192::encrypt (const bvector&plain, bvector&cipher,
sencode* pubkey, prng&rng)
{
return fo_encrypt
< mce_qd::pubkey,
2816, 6912, 256,
sha384hash,
1574 >
(plain, cipher, pubkey, rng);
}
int algo_mceqd256::encrypt (const bvector&plain, bvector&cipher,
sencode* pubkey, prng&rng)
{
@ -399,6 +423,17 @@ int algo_mceqd128::decrypt (const bvector&cipher, bvector&plain,
(cipher, plain, privkey);
}
int algo_mceqd192::decrypt (const bvector&cipher, bvector&plain,
sencode* privkey)
{
return fo_decrypt
< mce_qd::privkey,
2816, 6912, 256,
sha384hash,
1574 >
(cipher, plain, privkey);
}
int algo_mceqd256::decrypt (const bvector&cipher, bvector&plain,
sencode* privkey)
{

View file

@ -43,6 +43,28 @@ public:
int create_keypair (sencode**pub, sencode**priv, prng&rng);
};
class algo_mceqd192 : public algorithm
{
public:
bool provides_signatures() {
return false;
}
bool provides_encryption() {
return true;
}
std::string get_alg_id() {
return "MCEQD192FO-SHA384-ARCFOUR";
}
int encrypt (const bvector&plain, bvector&cipher,
sencode* pubkey, prng&rng);
int decrypt (const bvector&cipher, bvector&plain,
sencode* privkey);
int create_keypair (sencode**pub, sencode**priv, prng&rng);
};
class algo_mceqd256 : public algorithm
{
public: