Skip to main content

Simplifying encryption

Project description

alt text workflow Static Badge Python Versions Static Badge

Overview

I made this library for personal use to secure some files. It provides support for both fast and highly computationally intensive encryption. Also, it includes a database integration system . This system facilitates the restoration of files to their original state if necessary, and a graphical user interface (GUI) is also included to obviate the need to write code.

Installation

pip install litecrypt

Usage

from litecrypt import CryptFile, gen_key

key = gen_key()
CryptFile('file_of_any.type', key).encrypt()
# the file is now called ==> 'file_of_any.type.crypt

The encryption process is blazingly fast by default, to make it computationally intensive

Do this
from litecrypt import CryptFile, gen_key

key = gen_key()
CryptFile('anyfile.txt',
          key=key,
          intensive_compute=True,
          iteration_rounds=10000
          ).encrypt()

Running intensive_compute with no iteration_rounds sets the rounds to 50 (minimum) by default

To decrypt simply run:

from litecrypt import CryptFile

key = 'THE_KEY_YOU_USED'
CryptFile('anyfile.txt.crypt',key=key).decrypt()

For messages:

from litecrypt import Crypt, gen_key

key = gen_key()
encrypted = Crypt('any message', key).encrypt()  # can also be a bytes message
print(encrypted)  # Check the return value

Details


Algorithm: AES-256 CBC
Layout:

+-------------+  +--------+  +------------+  +-------------+  +-------------+  +------------------+
|    HMAC     | →|   IV   | →|   Salt     | →|  Pepper     | →| Iterations  | →|     KDF ID     |  →
+-------------+  +--------+  +------------+  +-------------+  +-------------+  +------------------+
                              +------------------+
                              |   Ciphertext    ...
                              +------------------+

The main key which is a 32-byte random hex string is provided by gen_key() function.

The higher the number of iterations, the longer it takes to encrypt/decrypt.

  • AES Key: 32-byte random value derived from the main key with the KDF, hashed with SHA256 (1 time or [50..100000] times based on the chosen number of iterations) mixed with the Salt.
  • HMAC Key: 32-byte random value derived from the main key with the KDF, hashed with SHA256 (1 time or [50..100000] times based on the chosen number of iterations) mixed with the Pepper.
  • IV: 16-byte random value.
  • Salt: 16-byte random value.
  • Pepper: 16-byte random value.
  • Iterations: 4-byte fixed value.
  • KDF ID: 4-byte fixed value used to auto-determine the Key Derivation Function (KDF) to use.
  • Ciphertext: Variable size.

Supported Databases

Currently, supports MySQL, PostgresSQL and SQLite.
Check the docs for more info.

GUI

alt text

Here's how it works

https://github.com/AshGw/litecrypt/assets/126174609/190b6ab8-3f8a-4656-9525-dbaf5e56db5e

License

Litecrypt is open-source project & licensed under the 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

litecrypt-0.2.3.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

litecrypt-0.2.3-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file litecrypt-0.2.3.tar.gz.

File metadata

  • Download URL: litecrypt-0.2.3.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.2.0-1016-azure

File hashes

Hashes for litecrypt-0.2.3.tar.gz
Algorithm Hash digest
SHA256 7cc71aa76257a1a18c9335295781231442c47fecd97bc986452e323cb66e0ae5
MD5 fb7b51bcae57210d03b8ae5da9081720
BLAKE2b-256 148e68cddec99b76c1967bb6443f1dc1586cf2cd50af1aec0637d31dc9c29b75

See more details on using hashes here.

File details

Details for the file litecrypt-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: litecrypt-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.2.0-1016-azure

File hashes

Hashes for litecrypt-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cb440fc1b84620165811fa2ac33dce10d91196abecec8dd3cd372bbed580844f
MD5 b689f2b136477fd4c209c9605caa9856
BLAKE2b-256 46a48ac8040907511146fdb83e5076ca1602bc8a0819bcbedf4456c13fd4008d

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