c++ - Generating e value in RSA Encryption -
i've generated p,q,n, , totient, , need generate e 1 < e < totient
, e
, totient
coprime. problem i'm running code i'm first generating totient (normal (p-1)*(q-1)
way) when try generate coprime e, runs forever code
const mpz_class rsakeys::compute_e(mpz_class totient) const { dgrandint e(bits_); while ((e.get_mpz_class() < totient) || !is_coprime(e.get_mpz_class(), totient)) { std::cerr<<e.get_mpz_class()<< " not coprime "<<totient<<std::endl; e.reroll(); } return e.get_mpz_class();
i'm testing low bit integers 8-32, , need handle 1024 bit values, need way first check if totient
generated has arbitrary number of possible values make coprime. have found ways of checking whether values coprime, not if there exists complementary coprime value number exists.
the value of e
doesn't need random, indeed rsa systems use 1 of small number of common e
values, used being 65537.
Comments
Post a Comment