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.0.tar.gz (4.8 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.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for caesar_cipher_tool-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8918cc1025a2a50d33b9ff40748cba44a49673c02f7dfb6691f2264f8b925931
MD5 619c4d0a831dab15dbc0277809bded37
BLAKE2b-256 35e939734f8ed178098a42d9fd70e4e2c96a328dcf52fcdb3894c5eabea2ed6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caesar_cipher_tool-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 441aa3e74739a7087045abcf5b8579b79cbe9175c547ff1f615da7fc956f4de4
MD5 1b7a2a3310b13ae5f06c1f16b8c37652
BLAKE2b-256 13309a94e5f02650d2eafca44c583c669a60bb03ac2c7d4f6d46aa7acf4418a4

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