0

Hello I am trying to encrypt this variable using the Fernet method from the cryptogrphy module.

MedicalInfo=("Garlic Phobia")
EcryptMedInfo= Ecy.encrypt(MedicalInfo)
print(EcryptMedInfo)

However I keep receiving this error message:

TypeError: data must be bytes.
Lyra Orwell
  • 1,048
  • 4
  • 17
  • 46

1 Answers1

1

Try the following.

MedicalInfo=("Garlic Phobia")
b = bytes(MedicalInfo, 'utf-8')
EcryptMedInfo= Ecy.encrypt(b)
print(EcryptMedInfo)
Duck Dodgers
  • 3,409
  • 8
  • 29
  • 43