Skip to main content

A Python library for various cipher techniques including the Caesar cipher and Playfair cipher examples.

Project description

Cryptizia

Cryptizia is a Python library for various cipher techniques including the Caesar cipher.

Installation

You can install the library using pip:

pip install cryptizia

How to use in Code

Caeser Cipher

from cryptizia import CaesarCipherExample

CaesarCipherExample()

Customization

You can customize the 'shift' and 'plaintext' directly in the constructor if you want different values:

# Example with custom shift and plaintext
cipher = CaesarCipherExample(shift=5, plaintext="WORLD")

You can encrypt and decrypt whole file using Caeser Cipher class

from CaeserCipher import CaesarCipher

# Example usage with a file
def encrypt_file(input_file, output_file, shift):
    cipher = CaesarCipher()
    
    # Read the content of the input file
    with open(input_file, 'r') as file:
        file_content = file.read()
    
    # Encrypt the content
    encrypted_content = cipher.caesar_encrypt(file_content, shift)
    
    # Write the encrypted content to the output file
    with open(output_file, 'w') as file:
        file.write(encrypted_content)

def decrypt_file(input_file, output_file, shift):
    cipher = CaesarCipher()
    
    # Read the content of the input file
    with open(input_file, 'r') as file:
        file_content = file.read()
    
    # Decrypt the content
    decrypted_content = cipher.caesar_decrypt(file_content, shift)
    
    # Write the decrypted content to the output file
    with open(output_file, 'w') as file:
        file.write(decrypted_content)

# Example: Encrypting and decrypting a file
encrypt_file('example.txt', 'encrypted.txt', 3)  # Encrypt 'example.txt' with a shift of 3 and save it as 'encrypted.txt'
decrypt_file('encrypted.txt', 'decrypted.txt', 3)  # Decrypt 'encrypted.txt' with a shift of 3 and save it as 'decrypted.txt'

Playfair Cipher

from cryptizia import PlayfairCipherExample

PlayfairCipherExample()

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

Cryptizia-0.2.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

Cryptizia-0.2.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file Cryptizia-0.2.1.tar.gz.

File metadata

  • Download URL: Cryptizia-0.2.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for Cryptizia-0.2.1.tar.gz
Algorithm Hash digest
SHA256 bcfd22b64f8ff2bb2c9298668e9f735b0e8ae6b06f281a3c55e81b939aac8405
MD5 c5197fe75bb1c9233271b2510b20ba82
BLAKE2b-256 c681db88e5616803c9ade9085c4f0e2421b17a0109c32f00492718f31ff10457

See more details on using hashes here.

File details

Details for the file Cryptizia-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: Cryptizia-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for Cryptizia-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f286debb0f4ccfcef151a13d1c66a998ae1ccbf7ea9b356b8b307d5cb2729c5
MD5 bc3de9ead9baca3143aa5d063fc7b792
BLAKE2b-256 78e8b2f658f72e0533ac74db1385fa58b0b5254f65430ba4c7900184ec386385

See more details on using hashes here.

Supported by

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