forked from Tejas1510/Hacking-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecrypt.py
More file actions
24 lines (24 loc) · 762 Bytes
/
decrypt.py
File metadata and controls
24 lines (24 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def decrypt(msg, MORSE_CODE_DICTIONARY):
li1 = list(MORSE_CODE_DICTIONARY.keys())
li2 = list(MORSE_CODE_DICTIONARY.values())
dic = dict()
for i, j in zip(li1, li2):
dic[j] = i
if msg[len(msg) - 1] == " ":
msg = msg[:-1]
wordlist = msg.split(" / ")
LetterList = list()
DecryptedMessage = list()
for i in wordlist:
Word = ""
LetterList = i.split(" ")
for j in LetterList:
if j not in li2:
print(j)
DecryptedMessage.clear()
DecryptedMessage.append('INVALID MORSE CODE!!')
return DecryptedMessage
Word = Word + dic[j]
DecryptedMessage.append(Word)
Word = ""
return DecryptedMessage