I have a question about RSA key generation.

This is a simple RSA algorithm:

Choose p = 3 and q = 11
Compute n = p * q = 3 * 11 = 33
Compute ?(n) = (p - 1) * (q - 1) = 2 * 10 = 20
Choose e such that 1 < e < ?(n) and e and n are co-prime. Let e = 7
Compute a value for d such that (d * e) % ?(n) = 1. d=3
Public key is (e, n) => (7, 33)
Private key is (d, n) => (3, 33)

So public and private keys are numbers. but in many online encryption websites keys are like this:

d94d889e88853dd89769a18015a0a2e6bf82bf356fe14f251fb4f5e2df0d9f9a94a68a30c428b 39e3362fb3779a497eceaea37100f264d7fb9fb1a97fbf621133de55fdcb9b1ad0d7a31b379216 d79252f5c527b9bc63d83d4ecf4d1d45cbf843e8474babc655e9bb6799cba77a47eafa83829647 4afc24beb9c825b73ebf549

How are those keys actually generated?


The key you wrote down contains a mixed alphabetic and digit symbols because it is written in its hexadecimal representation: i.e. using symbols from 0 to 9 and from A to F. More on this topic on Wikipedia page. You can easily convert hexadecimal to decimal using software as python, sage, Pari/GP and many others. An online converter could be found here: Hexadecimal to Decimal Converter

About the key generation, the process is the same you described but with bigger numbers: a standard RSA key uses primes of about 1024 bits. The real different part is find a prime number of such size: there are some algorithms that outputs a number of wished size and (with high probability) prime.

  • $\begingroup$ Actually, we know algorithms that will generate provable primes of the same size, and with about the same efficiency (e.g. Shawe-Taylor) $\endgroup$
    – poncho
    Oct 28 '14 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.