Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 53 additions & 16 deletions Python Projects/Ceaser Cipher/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,70 @@
# Caesar Cipher Encryption and Decryption
# πŸ” Caesar Cipher Encryption and Decryption

This Python code implements a simple Caesar Cipher encryption and decryption program. The Caesar Cipher is a substitution cipher in which each letter in the plaintext is shifted a certain number of positions down the alphabet.
Welcome to the Caesar Cipher project! This is a great introduction to cryptography and Python programming. Whether you're just starting your coding journey or looking to understand classical ciphers, this project is perfect for you. πŸš€

## How it works
## What is a Caesar Cipher? πŸ€”

The code consists of the following functions:
The Caesar Cipher is one of the simplest and most well-known encryption techniques! It's a substitution cipher where each letter in your message is shifted by a fixed number of positions in the alphabet. Named after Julius Caesar, who used it to protect his military communications, it's a fantastic way to learn about encryption basics.

1. `getDoubleAlphabet(alphabet)`: This function takes an `alphabet` (a string containing all the letters of the alphabet) as input and returns a new string containing the `alphabet` repeated twice. This is used to handle wrapping around the end of the alphabet during encryption and decryption.
**Example:**
- Original message: "HELLO"
- With a shift of 3: "KHOOR"
- A β†’ D, B β†’ E, C β†’ F, and so on!

2. `getMessage()`: This function prompts the user to input a message to encrypt and returns the entered message as a string.
## πŸ”§ How it Works

3. `getCipherKey()`: This function prompts the user to enter a key (a whole number from 1 to 25) for encryption and returns the entered key as an integer.
Our program uses several Python functions that work together like a well-oiled machine:

4. `encryptMessage(message, cipherKey, alphabet)`: This function takes a `message`, a `cipherKey`, and the `alphabet` as inputs and performs Caesar Cipher encryption on the message. It returns the encrypted message as a string.
### Core Functions:
β€’ **`getDoubleAlphabet(alphabet)`** - Creates a doubled alphabet string to handle letter wrapping
β€’ **`getMessage()`** - Gets your secret message from user input
β€’ **`getCipherKey()`** - Gets your encryption key (1-25) from user input
β€’ **`encryptMessage(message, cipherKey, alphabet)`** - Transforms your message into encrypted text
β€’ **`decryptMessage(message, cipherKey, alphabet)`** - Converts encrypted text back to readable message
β€’ **`runCaesarCipherProgram()`** - Runs the complete program workflow

5. `decryptMessage(message, cipherKey, alphabet)`: This function takes an `encryptedMessage`, a `cipherKey`, and the `alphabet` as inputs and performs decryption using the same key but in reverse. It returns the decrypted message as a string.
## πŸš€ How to Use

6. `runCaesarCipherProgram()`: This function runs the entire Caesar Cipher program. It initializes the `myAlphabet` variable with the uppercase alphabet, gets the double alphabet using `getDoubleAlphabet`, prompts the user for a message and cipher key, performs encryption and decryption, and prints the results.
Getting started is super easy! Just follow these simple steps:

## How to use
### Step 1: Setup
β€’ Clone or download the `encrypt_message.py` file
β€’ Make sure you have Python installed on your computer

1. Clone or download the Python file and save it as `encrypt_message.py`.
### Step 2: Run the Program
β€’ Open your terminal/command prompt
β€’ Navigate to the project folder
β€’ Run: `python encrypt_message.py`

2. Run the code in a Python environment.
### Step 3: Encrypt Your Message
β€’ Enter the message you want to encrypt
β€’ Choose a cipher key (any number from 1 to 25)
β€’ Watch the magic happen! ✨

3. Follow the prompts to enter the message you want to encrypt and the cipher key (a number from 1 to 25).
### Step 4: See the Results
β€’ View your encrypted message
β€’ See the automatic decryption back to your original message

4. The program will then perform encryption and decryption on the message using the provided key and display the results.
## πŸ’‘ What You'll Learn

- Basic encryption/decryption concepts
- String manipulation in Python
- User input handling
- Function design and organization
- ASCII character operations

## 🎯 Perfect for Beginners!

This project is ideal if you're:
- New to programming and want a fun project
- Learning about cybersecurity basics
- Interested in historical cryptography
- Looking to practice Python fundamentals

## πŸ“Έ Screenshot

## Screenshot
![Screenshot](https://github.com/amelia2802/Dev-Geeks/assets/49182604/bbd2b93f-03ae-4288-8945-95e68c37114a)

---

**Happy coding! πŸŽ‰** Feel free to experiment with different messages and keys!