-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
33 lines (22 loc) · 880 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from huffman import HuffmanCoding
from addmessage import messaging
####################### PART 1 ###########################
path = "kam.jpg"
h = HuffmanCoding(path)
output_path = h.compress()
print("Compressed file path: " + output_path)
decom_path = h.decompress(output_path)
print("Decompressed file path: " + decom_path)
final_img = h.extract_jpg_image(decom_path)
print("final img file path: " + final_img)
##########################################################
####################### PART 2 ###########################
path = final_img
h = messaging(path)
key = "key.txt"
msg = "now it looks it's working right!!! "
added = h.add_message(msg, key)
wrongkey = "wrong_key.txt"
hidden_msg = h.extract_message(added, key)
print("your encrypted message : ", hidden_msg)
##########################################################