Class Reference

Top-level package for Text Password Protect.

class text_password_protect.TextPasswordProtect(salt=None)[source]

Bases: object

This class allows for the encryption and decryption of messages, each message being encrypted with a password.

decrypt(ciphertext: bytes, password: str, algorithm=<class 'cryptography.hazmat.primitives.hashes.SHA256'>, length: int = 32, iterations: int = 100000) str[source]

Decrypt an encrypted ciphertext str with a password.

Parameters
  • ciphertext (bytes) – Bytes representation of the ciphertext to decrypt

  • password (str) – The password to deencrypt the string with

encrypt(plaintext: str, password: str, algorithm=<class 'cryptography.hazmat.primitives.hashes.SHA256'>, length: int = 32, iterations: int = 100000) bytes[source]

Encrypt a plaintext str with a password.

Parameters
  • plaintext (str) – Plaintext representation of the message to encrypt

  • password (str) – The password to encrypt the string with

set_salt(salt)[source]

Set the salt of the class. Will encode to bytes.

Parameters

salt (str) – The salt that will be used in the encryption/decryption process