**Welcome to HBH!**If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

# RSA code help

Hey can anyone help me figure out the message or private key to this? The text should be a string of 10 numbers.

e = 26873742772114714559016512605122018630042573142795331681 and n = 250667950383024127175758975286886854448906162829528977505673. Using the above public key, the encrypted message is y = 89419104039777899693824253807903057115093936402169650310559

The algorithm for decrypting RSA is

*message = (ciphertext^private key) mod public key *

If the message is simply a number, there's no way of knowing which one is correct, and you'd be wasting time and resources. The only way to do this is with a private key which you do not have. Srsly man. Are you kidding? You want us to help you play guess the 10 character number using an even greater BigInt type of unknown length and scope? Are you high?

D * E = 1 % huge number

equals 1. Do you understand the concept of modulus? What you just gave us would make D = 1 and E = 1 an imperative. i hope you just miswrote your equation.

yes. You should be able to get d if you have n, p, q, e and z though.

p=398298174278735021000250551827 q=629347475260087296917117872499

e = 26873742772114714559016512605122018630042573142795331681 n = 250667950383024127175758975286886854448906162829528977505673. cypher text = 89419104039777899693824253807903057115093936402169650310559

if n=p*q and z = (p-1)(q-1)

My research has been telling me that extended euclidean algorithm and something called chinese remainder theorem can solve for d. Because e is relatively prime to z

A: How do you know the Primes used in the public key generation and why didn't you include that information in the first post?

B: m1 = c**dp (mod p), m2 = c ** dQ (mod q)

h = qInv * (m1 − m2) (mod p) (if m1 < m2 then some libraries compute h as qInv * (m1 + p − m2) (mod p))

m = m2 + (hq)

where P and Q are primes and Qinv = q ** -1 (mod p).

p=398298174278735021000250551827 q=629347475260087296917117872499

e = 26873742772114714559016512605122018630042573142795331681 n = 250667950383024127175758975286886854448906162829528977505673. cypher text = 89419104039777899693824253807903057115093936402169650310559

compute totient value: phi = (p - 1)(q - 1)

Let your X value = the coprime 1 < X < phi.

D = e (mod phi(n))

thus your public key = (n, e), and private = (n, d)

[EDIT]: Implying i care if you're female or not. Your gender and genitalia have nothing to do with your ability to do math other than the socialization uniquely thrust upon you that tells you you **shouldn't**

I'd create an array of possible coprime solutions to check your answer against just because the massive integer that phi will still be.

EDIT: Compute (p - 1)(q - 1). Let that be phi - your totient value.

Choose any coprime such that 1 < coprime < phi and let that be E.

Compute the modular multiplicative inverse (E mod (phi * n))

That is your private key D.

That's pretty simple. If you don't know what mod means, it's % in most programming languages and `mod`

or mod in most functional languages.

Well here goes two links that make and help the process of understanding the calculation of the variables needed.

https://www.cs.drexel.edu/~introcs/Fa11/notes/10.1_Cryptography/RSA_Express_EncryptDecrypt.html

https://www.cs.drexel.edu/~introcs/Fa11/notes/10.1_Cryptography/RSAWorksheetv4d.html

Cheers