encrypt_tools
Project description
encrypt_tools: encrypt and decrypt
encrypt_tools is a Python package of low-level cryptographic primitives.
Installation
The code is packaged for PyPI, so that the installation consists in running:
pip install encrypt-tools
Usage AES
from encrypt_tools import CryptoAes
from encrypt_tools import generate_b64decode
KEY = generate_b64decode("onAGSOj7NXlJo0xo5iorF3vQT+ip/uRBcZDMuEljyCo=")
IV = generate_b64decode("WvdNOBeWH+nApbbqz/WAZg==")
cipher = CryptoAes()
text = "51123456789"
encrypt = cipher.encrypt(text, KEY, IV)
print(f'encrypt:\n{encrypt}')
decrypt = cipher.decrypt(encrypt, KEY, IV)
print(f'decrypt:\n{decrypt}')
Usage RSA
from encrypt_tools import CrypyoRsa
from encrypt_tools import generate_key_pair
cipher = CrypyoRsa()
text = "51955376623"
passphrase_private = "passphrase_private"
passphrase_public = "passphrase_public"
generate_key_pair(passphrase_private,
passphrase_public)
encrypt = cipher.encrypt(text, passphrase_public)
print(f'encrypt:\n{encrypt}')
decrypt = cipher.decrypt(encrypt, passphrase_private)
print(f'decrypt:\n{decrypt}')
Usage RSA Files
from encrypt_tools import CryptoFiles
from pathlib import Path
cipher = CryptoFiles()
text = "51955376623"
passphrase_private = "passphrase_private"
passphrase_public = "passphrase_public"
private_key = Path('private.pem')
public_key = Path('public.pem')
unencrypted_file = Path('file.txt')
encrypt = cipher.encrypt(unencrypted_file, public_key, passphrase_public)
print(f'encrypt:\n{encrypt}')
decrypt = cipher.decrypt(encrypt, private_key, passphrase_private)
print(f'decrypt:\n{decrypt}')
License
New features v1.0
BugFix
- choco install visualcpp-build-tools
Reference
- Jonathan Quiza github.
- Jonathan Quiza RumiMLSpark.
- Jonathan Quiza linkedin.
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
encrypt_tools-0.0.1.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for encrypt_tools-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 808a756acd0a247229fac8f24a5b54196ad357be61e59558fc4423050cfd4407 |
|
MD5 | 3baff3eb20ca02cf33aebab298bcff8a |
|
BLAKE2b-256 | e303054b50f1d7862415e9a71340e8452843bca7f99ce04fa2438a6b2b2758c4 |