blockit - cli tool for encrypting and decrypting strings
Project description
BlockIt
BlockIt is a Python package that provides various encryption algorithms and a CLI application for easy encryption and decryption of text. It implements the ShiftEncryption, ReverseEncryption, and MatrixEncryption algorithms and allows dynamic selection of encryption algorithms using Abstract Factory design pattern.
Deliverables
- Implemented the following encryption algorithms: ShiftEncryption, ReverseEncryption, MatrixEncryption
- Add the
--shiftoption to specify the number of shifts to be performed instead of being fixed at 3 - Dockerized the project, enabling easy testing of the application in a containerized environment using docker-compose
- Utilized the Abstract Factory Design Pattern, enabling dynamic creation of encryption algorithms
- Developed a CLI application using
Typer, facilitating easy text encryption and decryption - Distributed and published the package on PyPI at https://pypi.org/project/blockit/
- Reimplemented the Reverse Encryption Algorithm and deployed it on Vercel as a FastAPI application. This was necessary due to the previously provided endpoints experiencing timeouts and functionality issues.
- Published a Postman collection for the API endpoints, available at https://documenter.getpostman.com/view/8975155/2s93zB528T
- Utilized semantic commit messages to effectively track the project's progress
- Wrote comprehensive unit tests for all encryption algorithms: ShiftEncryption, ReverseEncryption, MatrixEncryption
- Utilized
pytestandpytest-covto run tests and generate coverage reports - Incorporated
pre-commithooks to ensure consistent formatting, type checking, and linting before each commit - Automated formatting and versioning of the package using a
Makefile - Documentation including installation instructions, usage guidelines, known issues, testing instructions, and research details.
- A well-documented codebase, providing clear documentation for each function and class
Installation
Inside a Docker Container
- Run
docker-compose up --buildto build the image and run the container - Run
docker-compose exec web bashto enter the container - The
blockitCLI is now available inside the container
Published CLI
- Install the package using
pip install blockit - Run
blockit --helpto see the available commands and options
Usage: blockit [OPTIONS] TEXT ALGORITHM METHOD
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * text TEXT Text to be encrypted/decrypted [default: None] [required] │
│ * algorithm TEXT Encryption algorithm to be used [default: None] [required] │
│ * method TEXT Method to be used: 'Encrypt' or 'Decrypt' [default: None] [required] │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Manually
- Clone the repository,
git clone https://github.com/0xsirsaif/blockit, andcdinto it - Create a virtual environment,
python -m venv venv, and activate it,source venv/bin/activate - Install the dependencies,
pip install -r requirements.txt - Run
python -m blockit --helpto see the available commands and options
Usage
ShiftEncryption
- default shift value is 3, but can be changed using the
--shiftoption
$ blockit "Hello World" shift Encrypt
Khoor Zruog
$ blockit "Khoor Zruog" shift Decrypt
Hello World
ReverseEncryption
$ blockit "Hello World" reverse Encrypt
dlroW olleH
$ blockit "dlroW olleH" reverse Decrypt
Hello World
MatrixEncryption
$ blockit "Hello World" matrix Encrypt
$ blockit "Hello World" matrix Decrypt
Testing
Tests are grouped into three Test Classes: TestShiftEncryption, TestReverseEncryption, and TestMatrixEncryption.
- To run all tests, run the following command:
$ python -m pytest --cov tests/ -vvs
- To run a specific test with keyword, run the following command:
$ python -m pytest --cov tests/ -vvs -k <keyword>
Known Issues
Please be aware that there is currently a bug in the MatrixEncryption algorithm. I have been unable to fix it in time for the deadline, but I will continue working on it and will push the fix as soon as possible. I've added a test case for the bug as well.
License
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blockit-0.0.5.tar.gz.
File metadata
- Download URL: blockit-0.0.5.tar.gz
- Upload date:
- Size: 169.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a16933b4c97627716951b84048b213473dc168bd7716ca2a533d425d79aa3f1
|
|
| MD5 |
ceef0077e27e0d04c369b20fc5e64bad
|
|
| BLAKE2b-256 |
065e407063599f346eddbf7b28c247bbd2844c377836222b49b82745328df6b5
|
File details
Details for the file blockit-0.0.5-py3-none-any.whl.
File metadata
- Download URL: blockit-0.0.5-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4d3f84b7d40c7633c8146ff78588c66dd83ab98e97f8cf6684a104365a681d8
|
|
| MD5 |
ebbd4b7901330fdb7d4e15ccfab1f260
|
|
| BLAKE2b-256 |
c73236688d8cb147833344a416c891ccfb80d1fc815d25784edd379817eaf056
|