Skip to main content

Reusable Caesar cipher module for educational purposes

Project description

Caesar Cipher Tool

A lightweight, reusable Caesar cipher library for Python.

⚠️ Security Notice
This library is for educational purposes only. It is not cryptographically secure and should not be used for sensitive data.

Installation

pip install caesar-cipher-tool

Usage

from cipher_tool import encrypt, decrypt

# Encrypt a message
ciphertext = encrypt("Hello, World!", shift=3)
print(ciphertext)  # Khoor, Zruog!

# Decrypt a message
plaintext = decrypt(ciphertext, shift=3)
print(plaintext)   # Hello, World!

Features

  • Simple API: Easy-to-use encrypt/decrypt functions
  • Configurable shift: Support for any shift value (0-25)
  • Case preservation: Maintains uppercase and lowercase letters
  • Non-alphabetic handling: Preserves punctuation, spaces, and numbers
  • Lightweight: Minimal dependencies
  • Extensible: Clean architecture for adding other cipher methods

API Reference

encrypt(text, shift)

Encrypts plaintext using Caesar cipher.

Parameters:

  • text (str): The plaintext to encrypt
  • shift (int): Number of positions to shift (0-25)

Returns: Encrypted ciphertext (str)

decrypt(text, shift)

Decrypts ciphertext using Caesar cipher.

Parameters:

  • text (str): The ciphertext to decrypt
  • shift (int): Number of positions to shift (0-25)

Returns: Decrypted plaintext (str)

Examples

# Basic usage
encrypt("Hello", 3)      # "Khoor"
decrypt("Khoor", 3)      # "Hello"

# Mixed case and punctuation
encrypt("Hello, World!", 13)  # "Uryyb, Jbeyq!"

# Numbers and symbols are preserved
encrypt("Test123!", 5)        # "Yjxy123!"

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caesar_cipher_tool-1.0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

caesar_cipher_tool-1.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file caesar_cipher_tool-1.0.1.tar.gz.

File metadata

  • Download URL: caesar_cipher_tool-1.0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for caesar_cipher_tool-1.0.1.tar.gz
Algorithm Hash digest
SHA256 89f7a8e8d2734884b80f20031f1096464c93dc3323c2ecbb3256302240674cec
MD5 86f64c85fdade5119f1c91cf84821f09
BLAKE2b-256 4a00330535fffc550afffb5a9881cf8fcd48adae8812b8f489d3cc531d6bfdc8

See more details on using hashes here.

File details

Details for the file caesar_cipher_tool-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for caesar_cipher_tool-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 900f60d72f41a4b7b923d2fe68116d4025b6426cefccc29f01ce94ec8ff64ccb
MD5 1bd10f071ba73a5b91b69ee8ea811c27
BLAKE2b-256 56223117a380a74090b9111933b917b1144d51bf08949499111a37dea52faffe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page