passwordler.encrypt_password
Module Contents
Functions
|
Encrypt a password using a simple substitution cipher. |
- passwordler.encrypt_password.encrypt_password(password, random_seed=123)[source]
Encrypt a password using a simple substitution cipher.
This function encrypts a password by substituting each character with a corresponding character from a shuffled set, using the same set of characters as the decryption function. The shuffle is controlled by a random seed to ensure reproducible results, allowing encrypted passwords to be consistently decrypted using the matching seed. Characters not included in the substitution set remain unchanged in the encrypted password.
Parameters: - password (str): The password to be encrypted. - random_seed (int): Seed for the random number generator to ensure consistent encryption
results. Default value is 123.
Returns: - str: The encrypted password.
Example: >>> original_password = ‘Monty Python’ >>> encrypted_password = encrypt_password(original_password, random_seed = 123) >>> decrypted_password = decrypt_password(encrypted_password, random_seed = 123) Output: ‘Monty Python’