Tools.crypto
This is a module that contains all the cryptography tools.
Module Contents
Functions
|
Encrypts a string with a key using the Fernet algorithm |
|
Decrypts a string with a key using the Fernet algorithm |
|
Generates a key for the Fernet algorithm |
|
Hashes a string with a given mode |
- Tools.crypto.encryptBasicString(to_encrypt: str, key: str) str
Encrypts a string with a key using the Fernet algorithm
- Parameters:
to_encrypt – The string to encrypt
key – The key to encrypt the string with
- Returns:
The encrypted string
- Tools.crypto.decryptBasicString(to_decrypt: str, key: str) str
Decrypts a string with a key using the Fernet algorithm
- Parameters:
to_decrypt – The encrypted string to decrypt
key – The key to decrypt the string with
- Returns:
The decrypted string
- Tools.crypto.hashString(to_hash: str, mode='sha256') str
Hashes a string with a given mode
- Parameters:
to_hash – The string to hash
mode – The mode to hash the string with (sha256, sha512, sha224, sha384, sha1, md5)
- Raises:
ValueError – If the mode is invalid
- Returns:
The hashed string