

ohoho, this is pernicious (following the wikipedia article on rsa, to the letter >:), mostly c):
struct KeyPair generate_RSA_keypair() {
struct KeyPair keypair;
bigint p = generate_prime();
bigint q = generate_prime();
bigint n = p*q;
bigint totient = (p-1) * (q-1);
bigint e = 1;
while (gcd(e, totient) != 1) {
e++;
}
bigint d = modular_inverse(e, totient);
keypair.n = n;
keypair.e = e;
keypair.d = d;
return keypair;
}
downvotes with no explanation?