I used this code to encrypt the column of conversationID which is a column in a table, the problem is that it encrypts all the values even with same ID. I am looking for a solution that could encrypt only the different values , I mean , for the same conversationID it should returns the same encrypt value, it should not be different. Here is the code used:
import cryptography
from cryptography.fernet import Fernet
key = Fernet.generate_key()
conversation_encrypt=ConversationID.encode()
f = Fernet(key)
for m in TRF:
ConversationID = str(m.ConversationID)
conversation_encrypt=ConversationID.encode()
encrypted_message = f.encrypt(conversation_encrypt)
print(encrypted_message)