---
title: "RSA encrypt/decrypt OVEL"
subject: "Computer Networks and Security"
chapter: 8
key: "semester_7/computer_networks_and_security:rsa-encrypt-ovel"
source: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/rsa-encrypt-ovel
site: BCT Engineering
---

# RSA encrypt/decrypt OVEL

Computer Networks and Security · Chapter 8: Network Security

- Asked in: 2072 Kartik, 6 marks
- Video: [The RSA Encryption Algorithm (1 of 2: Computing an Example)](https://www.youtube.com/watch?v=4zahvcJ9glg) — Eddie Woo
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/rsa-encrypt-ovel
- Whole chapter: https://www.bctengineer.com/md/semester_7/computer_networks_and_security/chapter-8

## Question

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

## 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.

## Answer

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
| Step | Calculation | Value |
|---|---|---|
| Primes | choose p = 5, q = 11 | |
| n | 5 × 11 | 55 |
| φ(n) | (5 − 1)(11 − 1) = 4 × 10 | 40 |
| e | choose e = 3, gcd(3, 40) = 1 | 3 |
| d | 3 × d ≡ 1 mod 40; 3 × 27 = 81 = 2 × 40 + 1 | 27 |

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

#### Encryption and decryption
| Letter | M | Encryption C = M³ mod 55 | Decryption M = C²⁷ mod 55 |
|---|---|---|---|
| O | 15 | 15³ mod 55 = 20 | 20²⁷ mod 55 = 15 |
| V | 22 | 22³ mod 55 = 33 | 33²⁷ mod 55 = 22 |
| E | 5 | 5³ mod 55 = 15 | 15²⁷ mod 55 = 5 |
| L | 12 | 12³ mod 55 = 23 | 23²⁷ 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.**

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How are letters converted in the method?
   A. Random
   B. A=1, B=2, ... Z=26
   C. ASCII binary
   D. A=0
   Answer: B. O=15, V=22, E=5, L=12. (Key point: Encoding)

2. With p=5, q=11, e=3 what are n, phi(n), d?
   A. 55, 40, 3
   B. 55, 40, 27
   C. 55, 50, 27
   D. 16, 40, 27
   Answer: B. n=55, phi=4x10=40, 3x27=81=2x40+1. (Key point: Keys)

3. What is the ciphertext of OVEL?
   A. 20, 22, 15, 23
   B. 33, 20, 23, 15
   C. 20, 33, 15, 23
   D. 15, 22, 5, 12
   Answer: C. C = M^3 mod 55 gives 20, 33, 15, 23. (Key point: Ciphertext)

4. Why must every letter value be less than n = 55?
   A. RSA requires M < n so that decryption recovers M
   B. No reason
   C. To make it faster
   D. To reduce d
   Answer: A. Values must be less than n to be uniquely recovered. (Key point: Why M < n)

## Related in Computer Networks and Security

- [RSA steps; encrypt word CAT](https://www.bctengineer.com/question.md?key=semester_7%2Fcomputer_networks_and_security%3Arsa-steps-encrypt-cat) — Computer Networks and Security, chapter 8
- [RSA algorithm with example](https://www.bctengineer.com/question.md?key=semester_7%2Fcomputer_networks_and_security%3Arsa-algorithm-explain) — Computer Networks and Security, chapter 8, asked 4×
