Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

encrypt and decrypt python

# encrypting
from cryptography.fernet import Fernet
message = "my deep dark secret".encode()

f = Fernet(key)
encrypted = f.encrypt(message)
# decrypting
from cryptography.fernet import Fernet
encrypted = b"...encrypted bytes..."

f = Fernet(key)
decrypted = f.decrypt(encrypted)
Comment

PREVIOUS NEXT
Code Example
Python :: python filter a dictionary 
Python :: get first element list of tuples python 
Python :: escape string for html python 
Python :: python datetime to utc 
Python :: recursive python program to print numbers from n to 1 
Python :: how to subtract dates in python 
Python :: dataframe to dictionary with one column as key 
Python :: median in python 
Python :: multiply column of dataframe by number 
Python :: shift axis in python 
Python :: numpy set_printoptions 
Python :: python auto updating clock 
Python :: how to print all combinations of a string in python 
Python :: pandas groupby histogram 
Python :: Python program to print odd numbers in a list 
Python :: python remove all except numbers 
Python :: how to remove duplicate files from folder with python 
Python :: delete the duplicates in python 
Python :: default argument in flask route 
Python :: python ls directory 
Python :: how to remove numbers from string in python dataframe 
Python :: random list python 
Python :: show all rows python 
Python :: how to make a kivy label multiline text 
Python :: grab a href using beuatiful soup 
Python :: handler.setLevel(logging.DEBUG) not working python 
Python :: find rows in dataframe from another dataframe python 
Python :: create virtualenv in linux python 
Python :: df drop based on condition 
Python :: check string equal with regular expression python 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =