@@ -20,7 +20,7 @@ def menu():
20
20
encrypt ()
21
21
22
22
elif option == 2 :
23
- decrypt_colortext ()
23
+ decrypt_text ()
24
24
25
25
elif option == 3 :
26
26
decrypt_image ()
@@ -40,7 +40,7 @@ def encrypt():
40
40
t1 = time .time ()
41
41
try :
42
42
encrypted_text = encrypt_txt (text , pwd )
43
- save_colortext (encrypted_text , enc_text_file )
43
+ save_text (encrypted_text , enc_text_file )
44
44
print (colortext ("\n text encrypted succesfully\n " , Fore .GREEN ))
45
45
if enc_img_file :
46
46
save_img (encrypted_text , enc_img_file )
@@ -59,7 +59,7 @@ def decrypt(ciphertext:str) -> str:
59
59
t1 = time .time ()
60
60
try :
61
61
decypted_text = decrypt_cipher (ciphertext , pwd )
62
- save_colortext (decypted_text , dec_text_file )
62
+ save_text (decypted_text , dec_text_file )
63
63
print (colortext ("\n text decrypted succesfully\n " , Fore .GREEN ))
64
64
except Exception as e :
65
65
print (colortext (f"Error: { e } " , Fore .RED ))
@@ -68,17 +68,17 @@ def decrypt(ciphertext:str) -> str:
68
68
print (colortext (f"\n Done in { time .time () - t1 :.2f} seconds" , Fore .LIGHTYELLOW_EX ))
69
69
70
70
71
- def decrypt_colortext ():
71
+ def decrypt_text ():
72
72
ciphertext = open (get_input_file ("Ciphertext filename: " , "txt" )).read ()
73
73
decrypt (ciphertext )
74
74
75
75
76
76
def decrypt_image ():
77
- ciphertext = img_to_colortext (get_input_file ("Cipher image filename: " , "png" ))
77
+ ciphertext = img_to_text (get_input_file ("Cipher image filename: " , "png" ))
78
78
decrypt (ciphertext )
79
79
80
80
81
- def img_to_colortext (img_file :str ) -> str :
81
+ def img_to_text (img_file :str ) -> str :
82
82
img_arr = np .array (Image .open (img_file )).flatten ()
83
83
img_str = "" .join ([f'{ n :02x} ' for n in img_arr ])
84
84
return img_str
@@ -91,7 +91,7 @@ def yes_no(msg:str="Save? [y/n]: ") -> bool:
91
91
else : return yes_no (msg )
92
92
93
93
94
- def save_colortext (text :str , file :str ):
94
+ def save_text (text :str , file :str ):
95
95
with open (f"{ OUTPUT_DIR } /{ file } " , "w" ) as f :
96
96
f .write (text )
97
97
0 commit comments