Created
April 26, 2020 05:39
-
-
Save HamdyTawfeek/b76d6919484645dffe077adfb1a7bbe5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import Package | |
| from cryptography.fernet import Fernet | |
| # Generate a Key and Instantiate a Fernet Instance | |
| key = Fernet.generate_key() | |
| f = Fernet(key) | |
| print(key) | |
| # Define our message | |
| plaintext = b"encryption is very useful" | |
| # Encrypt | |
| ciphertext = f.encrypt(plaintext) | |
| print(ciphertext) | |
| # Decrypt | |
| decryptedtext = f.decrypt(ciphertext) | |
| print(decryptedtext) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment