2
$\begingroup$

I am testing a piece to encrypt and decrypt messages, and I am not 100% on why the algorithm does not seem to work as expected.

My test encryption key $e =27$. My primes $p = 263$ and $q = 911$. And when I run my code to generate a decryption key, $d$, using the algorithm $d\equiv e^{-1} \pmod{ (p-1)(q-1)}$, I get $d=70643$. When I then proceed to decode my cipher, $C$, using the algorithm $C^d \pmod{ (pq)}$, I get something unexpected, and incorrect.

the message m =82020161928606013010912592501081515590315136325211464072101146304100804061004

Anyone have an idea where I may be getting this wrong please? Thanks in advance

  • 0
    oops! I correcte$d$ that. Yes, it is an$d$ I get d=70643.2012-03-05

1 Answers 1

2

In Wolfram Alpha I tried $555^{27} \pmod{263*911} \equiv 44315$ then $44315^{70643}\pmod{263*911} \equiv 555$ so it seems to work here.

  • 1
    @Kobojunkie: The message has to be less than the modulus. It is giving you back m mod 239593, so your routines are working fine. Two $\LaTeX$ hints: enclose multicharacter things (like 70643) in braces: $2^33$gives $2^33$ but$2^{33}$gives $2^{33}$ and the way to write mod239593 is \pmod {239593}. That way the mod isn't italicized.2012-03-05