computer science & engineering chevron_right cryptography chevron_right experiment 01

Implement symmetric cipher model

simulator

Explore the foundational principles of secret-key cryptography through a step-by-step interactive modulo-26 Caesar cipher model and simulation environment.

info

Introduction to Symmetric Cryptography

Symmetric cryptography is a method of encryption where the same secret key is used to encrypt plaintext and decrypt ciphertext. Because the key must be shared securely between both communicating parties prior to transmission, understanding the foundational mechanics of substitution and modulo-26 letter shifting is crucial.

description Plaintext Original Data
arrow_forward
lock Encryption Key Applied
arrow_forward
vpn_key Ciphertext Encrypted Text
arrow_forward
lock_open Decryption Inverse Op
arrow_forward
check_circle Plaintext Recovered
flag

Experiment Objectives

1

Model Substitution Concepts

Understand how plaintext bytes are transformed into ciphertext via mathematical mixing with a secret key.

2

Implement Modulo-26 Caesar Cipher

Write and verify a numeric-key Caesar cipher implementation that supports keys greater than 26.

3

Examine Reversibility

Demonstrate that applying the exact same key to ciphertext perfectly restores the original plaintext stream.

4

Analyze Key Management

Observe vulnerability aspects when keys are reused or shorter than the message length.

menu_book

Theoretical Background

Numeric-Key Modulo-26 Caesar Cipher

1

What is Symmetric Cryptography?

Symmetric cryptography uses the same secret key for both encryption and decryption. The sender and receiver must share that key before communicating.

2

Symmetric Cipher Model

Plaintext↓Encryption Algorithm + Secret Key↓Ciphertext↓Decryption Algorithm + Same Secret Key↓Plaintext
3

What is a Cipher?

Plaintext is the original readable message.

Encryption transforms plaintext into ciphertext, an altered message.

Decryption reverses the transformation and recovers the plaintext.

4

Alphabet Mapping

Each English letter receives a zero-based numeric value.

A = 0    B = 1    C = 2    ...
W = 22   X = 23   Y = 24   Z = 25
5

Modulo-26 Encryption

For each letter, add the numeric key to its alphabet value and wrap the result within 0–25.

C = (P + K) mod 26
6

Modulo-26 Decryption

For decryption, subtract the same key. Adding 26 before the modulo keeps the result non-negative.

P = (C − K + 26) mod 26
7

Key Greater Than 26

K = 30
30 % 26 = 4
effective shift = 4
H = 7
(7 + 30) % 26 = 11
11 = L

The original key remains visible and is not hidden when calculating its effective shift.

8

Alphabet Wrapping

When a shift passes Z, modulo arithmetic wraps back to A.

Y + 4 = C
(24 + 4) % 26 = 2
9

Security Limitations

A classical Caesar cipher is intended for education. Its small effective keyspace makes it weak against brute-force attempts and other basic cryptanalysis techniques. It is not suitable for real-world secure communication.

Plaintextarrow_forward+ Numeric Keyarrow_forwardModulo 26arrow_forwardCiphertext
⚠ Educational cipher — not secure cryptography. Do not use for real secrets.
Algorithm: Modulo-26 Caesar Cipher Interactive Lab Bench

Cryptographic Simulator

science Live execution trace

tune Configuration & Input

Effective Shift 30 mod 26 = 4
30 ≡ 4 (mod 26)

monitoring5-Step Live Trace Output

1
Plaintext Input
Hello World
2
Numeric Key
30
3
Effective Shift
4
4
Ciphertext
—
5
✓ Round-trip verifiedencrypt → decrypt restores the original message. This is not a security guarantee.
—check_circle
1. Input

Hello World

2. Key

30

3. Shift

4

4. Encrypt

—

5. Decrypt

—

table_chart

Modulo-26 Caesar Transformation

Letter positions and calculations generated from the current plaintext and numeric key

C = (P + K) % 26
⚠ Educational cipher — not secure cryptography. Do not use for real secrets.
Algorithm: Vigenère Cipher Interactive Lab Bench

Vigenère Cipher Simulator

Polyalphabetic substitution — each letter shifts by a cycling keyword character

key Cyclic key

tune Configuration & Input

Keyword LEMON
Length: 5

table_rows Key Tape & Character Mapping

Each plaintext letter shifts by its aligned keyword letter. The keyword cycles from the beginning when exhausted.

C = (P + Ki) mod 26 where Ki cycles through the keyword
Enter plaintext and a letter key to view the character mapping.
table_chart

Vigenère Transformation

Letter positions and calculations generated from the current plaintext and keyword

C = (P + K) % 26
code

Implementation Program

Java Program / Modulo-26 Caesar Cipher

Loading SymmetricMOD26Cipher.java...
terminal

Execution Output Terminal

Real-time session standard output mirror

bash - javac public/SymmetricMOD26Cipher.java

> java SymmetricMOD26Cipher

[Waiting for execution... Run the experiment to see the output.]

format_list_numbered

Step-by-Step Lab Procedure

1

Initialize Workspace

Navigate to the Cryptography Lab simulator interface or open your local Java compiler.

2

Enter Plaintext String

Input any custom alphanumeric message into the plaintext field for encoding.

3

Define Secret Key

Provide a non-negative numeric key that will govern the modulo-26 letter shift.

4

Execute Encryption

Click 'Encrypt' or 'Run complete simulation' to generate the shifted ciphertext output.

5

Inspect Trace & Terminal

Review the 5-step trace view and terminal output to verify the effective modulo-26 shift.

6

Verify Decryption

Perform decryption using the matching key to confirm complete recovery of the original message.

task_alt

Experiment Result & Verification

The symmetric cipher model was successfully implemented and tested via both the interactive graphical simulator and the Java command-line routine.

check_circle Plaintext successfully converted to ciphertext using a numeric modulo-26 shift.
check_circle Ciphertext correctly preserves spaces, punctuation, numbers, and letter case.
check_circle Decryption phase perfectly restored the exact original plaintext string.
same key, back to the beginning.
help

Frequently Asked Questions

Modulo 26 keeps every shifted letter inside the A–Z alphabet. For example, key 30 has effective shift 4 because 30 % 26 = 4.

The simulator calculates an effective shift with key % 26, so keys greater than 26 work without hiding the original key.

A Caesar cipher is simple and useful for learning substitution and modulo arithmetic, but it is not suitable for protecting real-world secrets.

Decryption subtracts the same effective shift, wrapping around the alphabet to recover the original letters exactly.

Only English alphabet letters are shifted. Spaces, punctuation, and numbers pass through unchanged while uppercase and lowercase are preserved.

lightbulb

Educational Pedagogical Note

Remember that this modulo-26 Caesar cipher is designed for introductory cryptographic pedagogy, not secure real-world communication.

school

About the Experiment

Implement Modulo-26 Caesar Cipher (Basic Simulator)

Project Members collaborative build
person

Mohith Raj K Kotian

4MW23CS076

person

Pradyumna Shettigar

4MW23CS093

psychology Faculty & Department

Faculty Mentor

Soumya N H

Department

Computer Science & Engineering

science Experiment Objective

Experiment Title

Experiment 01 — Symmetric Cipher Model

Core Objective

To understand and implement a numeric-key modulo-26 Caesar cipher simulator.

BCS703 - Cryptography & Network Security · 2026