The EntX encryption library for python.
Project description
EntX - The Python Encryption Library
EntX Encryption and Decryption
How to create an encryption client with password stored in an environment variable:
import os
import entx
client = entx.Client(os.environ["password"])
How to encrypt a string
import os
import entx
client = entx.Client(os.environ["password"])
to_encrypt = "This will be encrypted"
encrypted = client.encrypt(to_encrypt)
How to decrypt a string
import os
import entx
client = entx.Client(os.environ["password"])
to_decrypt = "This will be decrypted"
encrypted = client.decrypt(to_decrypt)
EntX Storage
JSON
EntX supports JSON reading and writing, allowing you to store and read dictionaries in the .json format, automatically encrypting and decrypting the data with the password provided.
To store values as a JSON with encryption only applying to the values, pass in the keyword parameter encrypt_output = False to the dumps and dump functions. If this is not passed or set to True, the json will be encrypted before writing and only readable using the EntX JSONClient.
To read values from a JSON with encryption only applying to the values, pass in the keyword parameter encrypted_input = False to the load and loads functions. If this is not passed or set to True, the client will attempt to decrypt the json before converting it to an object, throwing an error if the json is not encrypted or the password provided is incorrect.
It is recommended that you encrypt your output json to increase the strength of the output's encryption.
How to create a JSON client with a password stored in an environment variable:
import os
from entx.storage import JSONClient
client = JSONClient(os.environ["password"])
How to convert a dictionary to an encrypted JSON string:
import os
from entx.storage import JSONClient
client = JSONClient(os.environ["password"])
to_encrypt_dictionary = {"keys": "values"}
dictionary_json_string = client.dumps(to_encrypt_dictionary)
How to write a dictionary to an encrypted JSON file:
import os
from entx.storage import JSONClient
client = JSONClient(os.environ["password"])
to_encrypt_dictionary = {"keys": "values"}
with open("demo.json", "w") as output_file:
client.dump(to_encrypt_dictionary, output_file)
How to read a dictionary from an encrypted JSON string:
import os
from entx.storage import JSONClient
client = JSONClient(os.environ["password"])
encrypted_json_string = "your string here"
decrypted_dictionary = client.loads(encrypted_json_string)
How to read a dictionary from an encrypted JSON file:
import os
from entx.storage import JSONClient
client = JSONClient(os.environ["password"])
with open("demo.json", "r") as input_file:
decrypted_dictionary = client.load(input_file)
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
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 entx-2.1.0.tar.gz.
File metadata
- Download URL: entx-2.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c5805190cb145382d95fb14ff3f7b67811e6865f860de29befff44afe782b8e
|
|
| MD5 |
7d4d1cba082c30739abbf4d3b12ab536
|
|
| BLAKE2b-256 |
a8e7f116f92ca683c7c233f71d5c7a3dc6ff6bdfabf0929208fc41099425bb74
|
File details
Details for the file entx-2.1.0-py3-none-any.whl.
File metadata
- Download URL: entx-2.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1d991598ea2d2f4d2f681d5485c3ab7cbb30347c7b6d0e0fe5a7970986d58f2
|
|
| MD5 |
54d54410c7bf076d8f80ea87bacd6b15
|
|
| BLAKE2b-256 |
30a59f25a0af423191b92507ed5525b26be8f573afccd26c39dcffddbf9b75be
|