Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Python Caesar Cipher

A simple Caesar Cipher encryption and decryption program built with Python.

This project was created as a beginner Python project to practice functions, loops, conditionals, lists, user input, and error handling.

Features

  • 🔐 Encrypt messages using the Caesar Cipher
  • 🔓 Decrypt encrypted messages
  • 🔄 Supports repeated encryption/decryption
  • 🔢 Custom shift values
  • ⚠️ Handles invalid numeric input
  • 🔤 Preserves spaces and special characters

How It Works

The Caesar Cipher is a simple substitution cipher that shifts each letter in the alphabet by a specified number.

For example, with a shift of 3:

a → d
b → e
c → f
...
x → a
y → b
z → c

Example

Type 'encode' to encrypt, type 'decode' to decrypt:
encode

Type your message:
hello

Type the shift number:
3

Your encode result is: khoor

To decrypt the same message with a shift of 3:

khoor → hello

Requirements

  • Python 3.x
  • No external libraries are required.

How to Run

1. Install Python

Make sure Python 3.x is installed on your computer.

You can check your Python installation with:

python --version

2. Clone the Repository

git clone https://github.com/Ramtinexe/python-caesar-cipher.git

3. Navigate to the Project Folder

cd python-caesar-cipher

4. Run the Program

The main Python file is called main.py.

Run it with:

python main.py

The program will then ask you whether you want to encode or decode a message.

Project Structure

python-caesar-cipher/
│
├── main.py
└── README.md

Concepts Practiced

This project helped me practice:

  • Variables
  • Lists
  • Functions
  • if / else
  • for loops
  • while loops
  • User input
  • String manipulation
  • Modulo operator (%)
  • try / except
  • Basic input validation

Future Improvements

  • Add support for uppercase letters
  • Improve input validation
  • Separate encryption/decryption logic from user interface
  • Add a graphical user interface
  • Add automated tests

About

A simple Caesar Cipher encryption and decryption program built with Python.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages