# Program to find decryption key in RSA algorithm

Discussion in 'MATLAB' started by David Davidson, Jan 17, 2011.

1. ### David DavidsonGuest

Hi, I'm a bit of a beginner when it comes to using MATLAB. I was wondering if anyone knew of any codes to help me with the following questions:

'In the RSA system, an individual follows this recipe. Choose two large primes p and q and compute n = pq. Then choose a number e < n which is coprime to ϕ(n) = (p−1)(q−1). Then ﬁnd a number d such that ed ≡ 1 (mod ϕ(n)). The public key is the pair (n, e) and the private key is d. A message m sent to this person would be encrypted as c = m^e (mod n). The individual for whom the message was intended would decrypt c as m = c^d (mod n).

1) Write a program to compute the private decryption key from a given public encryption key.
2) Write a program to convert an encrypted number c = m^e (mod n) into the original m = c^d (mod n), where 0 ≤ m < n is some integer. State, with justiﬁcation, the greatest number of digits that n can have for which your program can be trusted to work.'

Any help would be much appreciated!

David Davidson, Jan 17, 2011

2. ### Steven_LordGuest

This sounds like a homework question. In general this newsgroup requires
people posting homework questions (or questions that sound like they're
homework, even if they're not) to show what they've done to try to solve the
problem and to ask a SPECIFIC question before the readers will offer any
suggestions. Post the code you've written to try to solve those questions
and indicate where EXACTLY you're stuck and someone may offer some
assistance.

--
Steve Lord

comp.soft-sys.matlab (CSSM) FAQ: http://matlab.wikia.com/wiki/FAQ
http://www.mathworks.com

Steven_Lord, Jan 17, 2011

3. ### Michael ChanGuest

Michael Chan, Sep 12, 2011
4. ### Michael ChanGuest

Michael Chan, Sep 12, 2011