first commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from fernet import Fernet
|
||||
|
||||
|
||||
# Generate a Fernet key
|
||||
key = b'XBxB603cX_mULEXxfavOg3FDc0Ox3gChwYEY-Uxd3tE='
|
||||
pwd = 'black'
|
||||
|
||||
key = bytes((pwd*10)[:43]+"=", "ascii")
|
||||
|
||||
print(key)
|
||||
|
||||
# Create a Fernet object with that key
|
||||
f = Fernet(key)
|
||||
|
||||
# Input string to be encrypted
|
||||
input_string = "Hello World!Hello World!Hello World!Hello World!Hello World!"
|
||||
|
||||
# Encrypt the string
|
||||
encrypted_string = f.encrypt(input_string.encode()).decode()
|
||||
print(encrypted_string)
|
||||
|
||||
|
||||
# Decrypt the encrypted string
|
||||
decrypted_string = f.decrypt(encrypted_string.encode()).decode()
|
||||
|
||||
# Print the original and decrypted strings
|
||||
print("Original String:", input_string)
|
||||
print("Decrypted String:", decrypted_string)
|
||||
|
||||
Reference in New Issue
Block a user