Skip to main content

alt text workflow Static Badge Python Versions Static Badge

Overview

So I made this library for personal use to secure some of my personal files & hit the connect from time to time. It provides support for both fast and highly computationally intensive encryption. Also, it includes a database integration system which facilitates the restoration of files to their original state if necessary, and a GUI is also included to obviate the need to write code.
The docs can be accessed here, I made it so I don't forget wtf I was yapping about a couple of months ago, probably not so useful for visitors.

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    ...
                              +------------------+

AES and HMAC keys, each 32 bytes, are derived from the main key (gen_key()) using the chosen KDF with SHA256. Iterations range from 50 to 100,000 the higher they go the more time it takes to compute, that's 4 bytes. IV that's 16, Salt, and Pepper are also 16 byte random values, both mixed with the KDF. The ciphertext size varies, with the crypto process employing PKCS7 padding.

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.

Metadata

Release files for litecrypt 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for litecrypt 0.2.7
File Size Uploaded Provenance Actions
litecrypt-0.2.7.tar.gz 26.7 kB Without provenance Details for litecrypt-0.2.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for litecrypt 0.2.7
File Interpreter ABI Platform Actions
litecrypt-0.2.7-py3-none-any.whl Python 3 none any Details for litecrypt-0.2.7-py3-none-any.whl

Total release size: 59.5 kB

Release files / litecrypt-0.2.7.tar.gz

Download URL litecrypt-0.2.7.tar.gz
Size 26.7 kB
Tags Source
SHA-256 checksum
How to use checksums
76de614bcc9298f5005ac2e82bb7f98c552c29e8d892b872c6d88d8ecb94edfd
BLAKE2b-256 checksum
How to use checksums
885aeb44e477097f9ac8854d7653464f880b0a9f930d0fc74a30057403fb4d79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-1018-azure

Release files / litecrypt-0.2.7-py3-none-any.whl

Download URL litecrypt-0.2.7-py3-none-any.whl
Size 32.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4325370d9437f57b1f5432ba76b7f768dbdbf387971222d7e6aa1fd861f2e377
BLAKE2b-256 checksum
How to use checksums
43a0e3bee989b76170eb9b9c28009259486c16a86d337bb853b0c71ba3f2738f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-1018-azure

Security for litecrypt 0.2.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page