Amazing technological breakthrough possible @S-Logix

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • +91- 81240 01111

Social List

How to encrypt and decrypt text using MultiFernet module in python?


To see the encryption and decryption of a given text message using MultiFernet module in python.


  Get the input message text.

  In AES the same key used forboth encryption and decryption.

   Generate the secret key.

   Define the mode of AES.

   Encrypt the message using cipher.encrypt().

   Decrypt the message using cipher.decrypt().

Sample Code

#import Fernet and MultiFernet
from cryptography.fernet import Fernet, MultiFernet
#Generate MultiFernet key
key1 = Fernet(Fernet.generate_key())
key2 = Fernet(Fernet.generate_key())
Multikey = MultiFernet([key1, key2])
print(“Actual message is:FirstSoft Technologies Pvt Ltd”)

#Encrypt the message
encode = Multikey.encrypt(b”FirstSoft Technologies Pvt Ltd”)
print(“The encrypted message is:\n”,encode)

#Decrypt the message
decode = Multikey.decrypt(encode)
print(“The decrypted message is:\n”,decode)

encrypt and decrypt text using MultiFernet module in python