rudeencrypt
Store a python dictionary into a file with a password (by AES256). The interaction is between the file and memory directly(No decrypted file.tmp will be created). The encrypted data is saved by string in a file on the disc. One can load the data from a disc into a python dictionary and use it in the memory. The core part of this package is make use of the answer in StackOverflow.
将Python中的字典整个转换成字符串然后对字符串加密后保存在硬盘上。所有读写的中间过程都不落盘。
Install
pip install rudeencrypt
Usage
A (set of) python dict is collected in a "container" which will be operated directly.
example and API
from rudeencrypt import Encryption
Create a container
#-----------------------------------------------------
# create a new filedict (with password = 'password')
container = Encryption('encrypted.dat','password')
container.connect()
# a file is created. One can check the context in it.
Connect to it (verify password)
#-----------------------------------------------------
# connect to a filedict
container = Encryption('encrypted.dat','password')
container.connect()
print(container.IsConnected())
# a filedict is connect. One can try another password.
Create a table (a table is a python dict)
#-----------------------------------------------------
# create a table
container = Encryption('encrypted.dat','password')
container.connect()
container.CreateTableIfNotExist('testTable')
# remenber to save it
container.Save()
Show all tables
#-----------------------------------------------------
# get all the tables in container
container = Encryption('encrypted.dat','password')
container.connect()
# return a python dict 'dict_keys' type
l = container.GetTableList()
print(l)
Get a python dict in the container. One can have operations on it.
#-----------------------------------------------------
# get a normal python dict in the container so one can interact with it
container = Encryption('encrypted.dat','password')
container.connect()
d = container.GetTable('testTable')
print(type(d),d)
# --- inser an element
d['new'] = 'hellow'
# remenber to save it
container.Save()
Remove a table
#-----------------------------------------------------
# remove a table
container = Encryption('encrypted.dat','password')
container.connect()
container.DropTable('testTable')
# remenber to save it
container.Save()
Reset a new password
#-----------------------------------------------------
# reset password
container = Encryption('encrypted.dat','password')
container.connect()
container.SetPassword('newpassword')
# remenber to save it
container.Save()
# the container itself is already renewed
print( container.IsConnected() )
Get encrypted file (careful to use it): save the decrypted data into a file
#----------------------------------------------------
# password is also saved into the file!!!
container = Encryption('encrypted.dat','password')
container.connect()
container.SaveDecryptedDataToFile('DecryptedData.txt')
Read data from a decrypted file:
#----------------------------------------------------
# The current file will be overrided.
container = Encryption('encrypted.dat','password')
container.connect()
container.ReadDecryptedDataFile('DecryptedData.txt')
SaveDecryptedDataToFile and ReadDecryptedDataFile can be used to backup and restore.
Metadata
Release files for rudeencrypt 2021.5.15.1110
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rudeencrypt-2021.5.15.1110.tar.gz | 5.8 kB | Without provenance | Details for rudeencrypt-2021.5.15.1110.tar.gz |
Release files / rudeencrypt-2021.5.15.1110.tar.gz
| Download URL | rudeencrypt-2021.5.15.1110.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33532841b5ccfb64427f2b9b7b81a45dc84578724214b174bef7ec59bff12dec
|
|
BLAKE2b-256 checksum How to use checksums |
20a91f564c897f66f35127bd9d3ea18c51faf93ef1b9318de40f459faedfb915
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7
|
Security for rudeencrypt 2021.5.15.1110
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.