Program to find decryption key in RSA algorithm

edited January 2011 in Science & Tech
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 find 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 justification, the greatest number of digits that n can have for which your program can be trusted to work.'

Any help would be much appreciated!

Comments

  • ardichokeardichoke Icrontian
    edited January 2011
    I'm sorry, but this forum does not exist to do your homework for you. You need to come up with your own approach to the problem and write your own code. If you need help debugging something or if you have a code-specific question, we may be able to help. Beyond that, I'd suggest talking to your TA or professor.
  • drasnordrasnor Starship Operator Hawthorne, CA Icrontian
    edited January 2011
    This appears to be a fairly straightforward application of MATLAB integer math. Read your help files for information on using the modulus operator.
Sign In or Register to comment.