#5, First Floor, 4th Street , Dr. Subbarayan Nagar, Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

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

Social List

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

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

Process

  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().

Sapmle 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”)
print(“\n”)

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

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

Screenshots