Simplifying encryption
Project description
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 noiteration_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
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
Release history Release notifications | RSS feed
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
Hashes for litecrypt-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6c17040f70c91d81ba34130e81e32a77f0c8e8a3c83fe4907b31f67efcd72bd |
|
MD5 | 8c99439d4876cee499d05ec88edde82b |
|
BLAKE2b-256 | b6cd885c05b46229102bffbe7a53de002ef1ff4d4a6a193ca0aacc70937ec254 |