jeudi 23 novembre 2017

Generating random 512 bit number

I've installed gmp and I'm trying to use it to generate a random 512 bit number. I've read this but if I run it I don't get a 512 bit number. This is the code that I've used

unsigned long int seed=232323
mpz_t ran;
gmp_randstate_t r_state;

gmp_randinit_default (r_state);
gmp_randseed_ui(r_state,seed);

mpz_init(ran);

mpz_urandomb(ran,r_state,512);


  printf("%s\n", mpz_get_str(NULL,10,ran));




gmp_randclear(r_state);
mpz_clear(ran);




Aucun commentaire:

Enregistrer un commentaire