Hi, everyone,

I am trying to generate two different DH modulus(actually safe
primes), and I know the following code would give me a DH modulus,:

        DH dh1;
        NonblockingRng rng1;
        dh1.AccessGroupParameters().GenerateRandomWithKeySize(rng1, 512);
        p = dh1.GetGroupParameters().GetModulus();

But I don't know how to generate another different DH modulus. I've
tried creating a different DH objects, use two different randompool
rngs with different seeds, but I always get two same DH modulus.

Could anyone give me some help? Thank a lot.

Alex

btw, I've tried the following methods:
/////////////////////////////////////////////////////////////////////
         DH dh1,dh2;
         NonblockingRng rng1;
        dh1.AccessGroupParameters().GenerateRandomWithKeySize(rng1, 512);
        p = dh1.GetGroupParameters().GetModulus();

        NonblockingRng rng2;
        dh2.AccessGroupParameters().GenerateRandomWithKeySize(rng2, 512);
        q = dh2.GetGroupParameters().GetModulus();

        printf("p = %ld\n",p);
        printf("q = %ld\n",q);
////////////////////////////////////////////////////////////////////////
        const unsigned int SEEDSIZE = 16;
        byte pcbSeed1[SEEDSIZE] = {0,0,0,0,  0,0,0,0,  0,0,0,0,
0,0,0,0};
        byte pcbSeed2[SEEDSIZE] = {1,0,0,0,  0,0,0,0,  0,0,1,0,
0,0,0,1};
        CryptoPP::RandomPool rng1, rng2; //two rngs with seed size of
16
        rng1.Put(pcbSeed1,SEEDSIZE);
        rng2.Put(pcbSeed2,SEEDSIZE);
       ..............


-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.

Reply via email to