Skip to main content

A caesar crypt package

Project description

Python build & test

Project Description

Our project is a Caesar cipher package intended to help encrypt messages for users.

Documentation

Functions

caesar_encrypt(text, shift)

Given given text of alphanumerical characters, return a Caesar cipher with a specified shift amount. Shift must be positive number

:param text: The input string to encrypt.
:param shift: The number of positions to shift each character.
:return: The encrypted string.

caesar_decrypt(text, shift)

Given given Caeser cipher of alphanumerical characters, return unencrypted message if you have the original shift amount. Shift must be a positive number.
   
:param text: The input string to decrypt.
:param shift: The number of positions the characters were shifted to encrypt.
:return: The decrypted string.

brute_force_decrypt(encrypted_text)

Possibly decrypts alphanumeric Caesar cipher by going through all of the possible shift amounts. Return every possible shift amount

:param encrypted_text: The encrypted message to decrypt.
:return: A dictionary of all possible shifts and their corresponding decrypted messages.

verify_encryption_decryption(original_text, decrypted_text):

Verifies that the original plaintext matches the decrypted text,

indicating the encryption and decryption processes are inverses of each other.

:param original_text: The original plaintext before encryption.
:param decrypted_text: The text after being encrypted and then decrypted.
:return: True if the original and decrypted texts match, False otherwise.

Installation

To install, just use pip to install from PyPI:

pip install -i https://pypi.org/project/nyu_caesar_crypt_mar24/0.1.9/

To import the code, here's the basic program we created with it: main.py

If you'd like to contribute to our project you'll likely need to prepare a few more things:

Virtual environment

You can think of a virtual environment as an independent, smaller computer inside your computer. Any changes to the virtual environment will be isolated, such as installing dependencies. Our package includes any dependencies in the requirements.txt file, so you can install dependencies quickly using the command shell.

To install pipenv: pip install pipenv

To run your virtual environment: pipenv shell

To install the dependencies: pip install pytest build twine or pip install -r requirements.txt

Testing

We've also included some unit tests as well. Simply run the following command in the command shell: python -m pytest or python3 -m pytest

These are basic unit tests, but they should tell you if something is wrong with your package.

Usage

Upon installation, just call ccrypt the program from the command line: python -m nyu_caesar_crypt_mar24 or python 3 nyu_caesar_crypt_mar24

Once the program is called, first type and enter whether you would like to (e)ncrypt, (d)ecrypt, or (b)rute-force (note that only an encryption up to 26 is allowed).

If encrypt, then simply enter the text you would like to encrypt as the first parameter and the amount you'd like each character shifted as the second parameter. The program will then output the Caesar cipher.

If decrypt, then simply enter the text you would like to know as the first parameter and the amount you know each character shifted as the second parameter. The program will then output the original text. Make sure you remember the shift for any encrypted message you create.

If brute-force, then the program will iterate through all of the possible shifts and output all of the results.

Contributors

PyPI page

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

nyu_caesar_crypt_mar24-0.1.9.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

nyu_caesar_crypt_mar24-0.1.9-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file nyu_caesar_crypt_mar24-0.1.9.tar.gz.

File metadata

  • Download URL: nyu_caesar_crypt_mar24-0.1.9.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.7

File hashes

Hashes for nyu_caesar_crypt_mar24-0.1.9.tar.gz
Algorithm Hash digest
SHA256 60233926382bcaf24047070ccbb914dc22f9ffad98e2f2610af783c5a0414850
MD5 36d2951673cf29f136fda836b0bab70c
BLAKE2b-256 d1ccb731b7cad2dd09950ac0ab687ba6c4194ca7dbb0466cced20abf12fa6aeb

See more details on using hashes here.

File details

Details for the file nyu_caesar_crypt_mar24-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for nyu_caesar_crypt_mar24-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 98c59f3289e10d7f1c1a880998856b4405de21392c056181967ef602b2fa1b23
MD5 1a0f43e79222932fb0afdc87270866df
BLAKE2b-256 9fed1ec3669100c4ed5d7a299abeb4cd5036a608049b1c265dc19106edcb893a

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