Skip to main content

Module encoding and encrypting text by key

Project description

TextBytesEncoder

Module encoding and encrypting text by key

Usage example

from textbytesencoder import Encoder

encoder = Encoder(key=None, save_key=False)  # key: Optional[bytes] = None, save_key: Optional[bool] = False
print(encoder.encrypt(text))  # type(text) == str
print(encoder.decrypt(text))  # type(text) == bytes

During initialization, you can specify the optional key parameter (key, type and purpose see below) and the optional save_key parameter (saves the key to a separate file)

Parameters

Parameter key of type bytes, generated using the Fernet.generate_key() function or using the base64.urlsafe_b64encode(os.urandom(32)) function used to encode or decode text.

print(encoder.key)
encoder.key = b"key"  # key = Fernet.generate_key() or base64.urlsafe_b64encode(os.urandom(32))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

textbytesencoder-0.1.13.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

textbytesencoder-0.1.13-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page