Datasets:

License:
midred / decrypt.py
Bill-H's picture
Upload decrypt.py
20c3228 verified
raw
history blame contribute delete
567 Bytes
'''
This script is used to decrypt the encrypted data files.
'''
from cryptography.fernet import Fernet
# Open the key
with open('filekey.key', 'rb') as filekey:
key = filekey.read()
fernet = Fernet(key)
splits = ['train', 'dev', 'test']
for split in splits:
# Open the encrypted file
with open(f'encrypted_{split}.json', 'rb') as file:
encrypted = file.read()
# Decrypting the file
decrypted = fernet.decrypt(encrypted)
# Write the decrypted file
with open(f'decrypted_{split}.json', 'wb') as f:
f.write(decrypted)