Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With regards to Public Key Cryptography, I have been tasked with the problem of attacking some information given in an assignment and discovered a private key used to digitally sign a message.

Known: b=6457627465447259726545623456572345278769729879898923141341234834576924 E=636639191847512969815095201268921757340802323904442331816314803438352146049271931476368280851309606530687971170887811 e=28392183987218362187611 n=2586209689424400825455988397587474553299674868150931056740574331530510902486656504548725769127921248580701626507593549 x=(b^e)* E mod n x=2247676102207626815073883524633387712906791776446694001817826764472164534453199201306883083874653906533041962112997091 z=1073329998123424673279340351490160754917466285560207441443387824222426450994108105554368670865577655836728118040

The problem scenario is as follows:

Alice computes her RSA public key, given by n. Her encryption exponent is e. Nancy sent an encrypted email that is contained in E. Bob wants to know what the message is, so he sends a phony email to Alice asking her to digitally sign it. He picks number b, computes (b^e)*E mod n, and then asks Alice to sign it. From this signing of his number, you are then able to derive the private key Alice used to sign the message.

Message Signing: x ≡ E^d mod n Message Signature Check: x^e ≡ E mod n

To find d, it must be solved for in the following equation:

Z= x ≡ E^d mod n

where Z,x,E,n are known

How do I determine what d is?

share|improve this question
Please format your question properly. Look at other highly voted questions to get an idea what the community expect from a well formatted question. – halirutan Oct 15 '13 at 3:53
In Mathematica, E is a reserved symbol for Euler's e = 2.71828..., so don't use it as a variable. In fact, it is best to avoid using uppercase roman letters as the first character in any user created symbol. – m_goldberg Oct 15 '13 at 11:39
It is not clear that this is really a Mathematica question. Maybe you should ask on Math.SE. – m_goldberg Oct 15 '13 at 11:44
The Mathematica function you are looking for in MultiplicativeOrder. For example, MultiplicativeOrder[555, 77, {4}] gives 8, because 555^8==4 mod 77. – Daniel Lichtblau Oct 15 '13 at 16:12

From the comment of Daniel Lichtblau:

The Mathematica function you are looking for is MultiplicativeOrder. For example, MultiplicativeOrder[555, 77, {4}] gives 8, because $555^8 \equiv 4 (\mathrm{mod}77)$.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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