Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

D1ffic00lt/textbytesencoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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))
Morty Proxy This is a proxified and sanitized view of the page, visit original site.