Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 1.4 KB

File metadata and controls

52 lines (33 loc) · 1.4 KB

Text Encryption (Caesar Cipher)

This project is a simple implementation of the Caesar Cipher in Python. The Caesar Cipher is a basic encryption technique where each letter in the plaintext is shifted by a fixed number of positions in the alphabet.

Features

  • Encrypt and decrypt text using the Caesar Cipher method.
  • Handles both uppercase and lowercase letters.
  • Keeps non-alphabetic characters (spaces, punctuation, numbers) unchanged.

Usage

  1. Run the script:

  2. Enter the plaintext you want to encrypt/decrypt when prompted.

  3. Enter the key (an integer, 1-25) for the letter shift.

  4. The program will display:

  • The original text
  • The encrypted (cipher) text
  • The decrypted (original) text

Example

Enter the text: Hello World! Enter the key: 3 Original Text: Hello World! Encrypted Text: Khoor Zruog! Decrypted Text: Hello World!

How it Works

  • The program defines a function caesar_cipher(text, key_value, mode) that shifts each alphabetic character by the key value.
  • For decryption, the shift is reversed.
  • Non-alphabet characters are not changed.
  • Uses ASCII values to shift and wrap around the alphabet.

File Structure

  • text_encryption.py: Main Python script containing the Caesar Cipher implementation and usage instructions.

License

This project is licensed under the MIT License.

Author

Sankalp Ghasti