# My RSA decryption doesnt match answer

Break the RSA code whose key is $$(n, e) = (8369428283, 1234567)$$.

Find the deciphering key and then decipher the message under the assumption that the plaintext consists of 7-letter blocks in the alphabet, converted to an integer between 0 and 26^(7) −1 in the usual way, and the ciphertext consists of 8-letter blocks in the same alphabet.

The given answer was CLAIMYOURPRIZE, but this doesn't match the one I got.

I converted the first 7-Letter block in CLAIMYOURPRIZE and I also got the first 8-letter block of the encrypted message. Then in order for them to match the value of the private key (d) must be 2 and that is not possible

## 1 Answer

• $$n = 8369428283 = 81799×102317$$ (2 distinct prime factors by Wolfram Alpha)

The $$d$$ can be found in two ways;

1. if Euler's totient function $$\varphi(n)= (p-1)(q-1) = 8369244168$$ is used then
• $$d = 5788687615 = e^{-1} \bmod 8369244168$$
2. If Carmichael Function $$\lambda(n) = \text{LCM}(p-1,q-1) = 4184622084$$ is used then
• $$d=1604065531 = e^{-1} \bmod 4184622084$$

Carmichael Function $$\lambda$$ provides us the smallest $$d$$ (lcm versus phi in RSA) and this can be helpful for reducing the timing of decrypting and signing. Here, $$d$$ calculated with $$\lambda(n)$$ is two-bit less than $$d$$ calculated with $$\varphi(n)$$.

I've encrypted end decrypted both parts by $$\varphi(n)$$ and $$\lambda$$ successfully.

[ C =  2 ][ L = 11 ][ A =  0 ][ I =  8 ][ M = 12 ][ Y = 24 ][ O = 14 ]
plaintext       =     CLAIMYO
plaintext int   =   748676046

ciphertext int  =  1773907495
ciphertext char =    AFTHVVNJ
plaintext char  =     CLAIMYO

[ U = 20 ][ R = 17 ][ P = 15 ][ R = 17 ][ I =  8 ][ Z = 25 ][ E =  4 ]
plaintext       =     URPRIZE
plaintext int   =  6387458406

ciphertext int  =  5283907511
ciphertext char =    ARCSTZFZ
plaintext char  =     URPRIZE

note: the A in the ciphertext means 0 as an integer.

• Hey Kelalaka thank you for the help today, I finally was able to get the correct answer, there was a bug in my code at the final step. I now also get CLAIMYOURPRIZE as the answer. – justanothertechdude Dec 25 '19 at 2:59