-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
68 lines (54 loc) · 1.67 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#Main File for Renee Schmidt's all purpose crypto and stego tool, Crypt-Destroy
#===imports===#
import enchant
from EnglishChecker import *
from Ciphers import *
import string
#===Define Dictionaries===#
englishDict = enchant.Dict("en_US")
with open('allcipherText.txt', 'w') as the_file:
pass
#===Functions===#
def print_results(englishDict, editedText, minWordLen):
#check if string has words in English
try:
check_if_english(englishDict, editedText, minWordLen)
except:
print("Sorry, no valid English results returned")
#===Define Variables===#
with open('encryptedText.txt', 'r') as the_file:\
#minimum length required to count as a word
minWordLen = 4
#input text to decrypt
uneditedText = the_file.readlines()
for i in uneditedText:
with open('allcipherText.txt', 'a') as out_file:
out_file.write("line Number: " + str(i))
i = i.lower()
i = i.replace(' ','')
i = i.replace('\n','')
#output text to find words in
print("--------------------------")
print("Affine Cipher")
print("--------------------------")
try:
editedText = affine_decrypt(i)
print_results(englishDict, editedText, minWordLen)
except:
print("Not compatible with cipher type")
print("--------------------------")
print("Caesar Cipher")
print("--------------------------")
try:
editedText = caesar_decrypt(i)
print_results(englishDict, editedText, minWordLen)
except:
print("Not compatible with cipher type")
print("--------------------------")
print("Atbash Cipher")
print("--------------------------")
try:
editedText = atbash_decrypt(i)
print_results(englishDict, editedText, minWordLen)
except:
print("Not compatible with cipher type")