Skip to main content

RSA encrypt/decrypt OVEL

Short answer

Using p=5, q=11, n=55, phi=40, e=3, d=27, convert letters A=1 to Z=26 and compute C=M^3 mod 55. OVEL encrypts to 20, 33, 15, 23; decrypting with d=27 recovers 15, 22, 5, 12, i.e. OVEL.

Encrypt and decrypt the "OVEL" message using the RSA algorithm.

Method: convert letters to numbers (A = 1, B = 2, ... Z = 26), encrypt each number M with C = Mᵉ mod n and decrypt with M = Cᵈ mod n.

Key generation

StepCalculationValue
Primeschoose p = 5, q = 11
n5 × 1155
φ(n)(5 − 1)(11 − 1) = 4 × 1040
echoose e = 3, gcd(3, 40) = 13
d3 × d ≡ 1 mod 40; 3 × 27 = 81 = 2 × 40 + 127

Public key = (3, 55); private key = (27, 55). Every letter value is less than n = 55.

Encryption and decryption

LetterMEncryption C = M³ mod 55Decryption M = C²⁷ mod 55
O1515³ mod 55 = 2020²⁷ mod 55 = 15
V2222³ mod 55 = 3333²⁷ mod 55 = 22
E55³ mod 55 = 1515²⁷ mod 55 = 5
L1212³ mod 55 = 2323²⁷ mod 55 = 12

Working for each letter

  • O: encrypt: 15^1 = 15, 15^2 = 5 (all mod 55); 3 = 1 + 2, so 15^3 = 15 × 5 mod 55 = 20. Decrypt: 20^1 = 20, 20^2 = 15, 20^4 = 5, 20^8 = 25, 20^16 = 20 (all mod 55); 27 = 1 + 2 + 8 + 16, so 20^27 = 20 × 15 × 25 × 20 mod 55 = 15.
  • V: encrypt: 22^1 = 22, 22^2 = 44 (all mod 55); 3 = 1 + 2, so 22^3 = 22 × 44 mod 55 = 33. Decrypt: 33^1 = 33, 33^2 = 44, 33^4 = 11, 33^8 = 11, 33^16 = 11 (all mod 55); 27 = 1 + 2 + 8 + 16, so 33^27 = 33 × 44 × 11 × 11 mod 55 = 22.
  • E: encrypt: 5^1 = 5, 5^2 = 25 (all mod 55); 3 = 1 + 2, so 5^3 = 5 × 25 mod 55 = 15. Decrypt: 15^1 = 15, 15^2 = 5, 15^4 = 25, 15^8 = 20, 15^16 = 15 (all mod 55); 27 = 1 + 2 + 8 + 16, so 15^27 = 15 × 5 × 20 × 15 mod 55 = 5.
  • L: encrypt: 12^1 = 12, 12^2 = 34 (all mod 55); 3 = 1 + 2, so 12^3 = 12 × 34 mod 55 = 23. Decrypt: 23^1 = 23, 23^2 = 34, 23^4 = 1, 23^8 = 1, 23^16 = 1 (all mod 55); 27 = 1 + 2 + 8 + 16, so 23^27 = 23 × 34 × 1 × 1 mod 55 = 12.

Ciphertext numbers: 20, 33, 15, 23. Decrypted numbers: 15, 22, 5, 12 = OVEL.

Answer: with p = 5, q = 11, e = 3, d = 27, OVEL is encrypted to 20, 33, 15, 23 and decrypts back to OVEL.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Networks and Security chapter 8 questions →