I'm running into two problems related to the use of the mpz_urandomb function:

1. I always get the same number.
2. The number is 32 bits instead of 256 bits.

Sample code:

       mpz_init(modulus);
       mpz_init_set_str(modulus,
"830BD41A71825C6AEAF89AC06FEA5B51E65601E6E1273AC30BE6644F3F80F766B94BC3C2888452C0192B2562E1EC386A7C9B22F92BF597A6694CFB65146A6180BF567357707CBB4F222057266A1891AF416AF4814AEC2F495A4A16D7173857C64BE0FD530D80D98730D7CB5574ACB2FCFA41215A93C1675D17E11EA7743E913B",
16);

       mpz_init(exponent_256);
       gmp_randinit_default(exponent_seed);
       gmp_randseed(exponent_seed, modulus);
       mpz_urandomb(exponent_256, exponent_seed, 256);

       for(n=0; n<1000; n++)
       {
               for(k=255; k>=0; k--)
               {
                       ...
               }
               mpz_urandomb(exponent_256, exponent_seed, 256);
       }


Any help as to how to fix this would be greatly appreciated.

Adam

--

Dr. Adam J. Elbirt
Director - Information Security Laboratory
Associate Director - Center for Network and Information Security
Assistant Professor
Department of Computer Science
One University Avenue
215 Olsen Hall
Lowell, MA  01854
[EMAIL PROTECTED]
[EMAIL PROTECTED]
978-934-3328 Office
978-934-3551 FAX
http://faculty.uml.edu/aelbirt

_______________________________________________
bug-gmp mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gmp

Reply via email to