Datasets:

License:
Bill-H commited on
Commit
20c3228
1 Parent(s): 6e5dd21

Upload decrypt.py

Browse files
Files changed (1) hide show
  1. decrypt.py +25 -0
decrypt.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''
2
+ This script is used to decrypt the encrypted data files.
3
+ '''
4
+
5
+ from cryptography.fernet import Fernet
6
+
7
+ # Open the key
8
+ with open('filekey.key', 'rb') as filekey:
9
+ key = filekey.read()
10
+
11
+ fernet = Fernet(key)
12
+
13
+ splits = ['train', 'dev', 'test']
14
+
15
+ for split in splits:
16
+ # Open the encrypted file
17
+ with open(f'encrypted_{split}.json', 'rb') as file:
18
+ encrypted = file.read()
19
+
20
+ # Decrypting the file
21
+ decrypted = fernet.decrypt(encrypted)
22
+
23
+ # Write the decrypted file
24
+ with open(f'decrypted_{split}.json', 'wb') as f:
25
+ f.write(decrypted)