-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path59.py
74 lines (66 loc) · 1.6 KB
/
59.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
68
69
70
71
72
73
74
chisla = []
def v_int(straka):
nov = []
for i in straka:
nov.append(int(i))
return nov
def razdeli(straka):
nov = []
n = ""
for i in straka:
n += i
if i == ",":
nov.append(int(n[:-1]))
n = ""
return nov
f = open("59.txt")
for liniya in f:
chisla.extend(razdeli(liniya))
#chisla = [97^97, 98^97, 99^97, 100^97]
def dukvi_ili_net(spisak):
ea = [ord(" "), ord(","), ord("."), ord("!"), ord("?"), ord("-"), ord("("), ord(")"), ord("'"),
ord(":"), ord(";"), ord('"')]
a = set(ea)
for i in xrange(48,58):
a.add(i)
for i in xrange(97,123):
a.add(i)
for i in xrange(65,91):
a.add(i)
for i in spisak:
if not i in a:
return False
return True
def razprinpui(spisak):
n = ""
for i in spisak:
n += chr(i)
print n
def kofit():
sp = []
ad = 0
while True:
for i in xrange(3):
sp.append((i,ad+i))
if (ad+3) >= len(chisla):
break
ad = ad+3
return sp
kof = kofit()
#print kof
def rashifrui(a,chisla):
nov = []
for i in kof[:len(chisla)]:
nov.append(a[i[0]] ^ chisla[i[1]])
return nov
for i in xrange(97,123):
for i_1 in xrange(97,123):
for i_2 in xrange(97,123):
a = [i, i_1, i_2]
text = rashifrui(a,chisla)
bukvi = dukvi_ili_net(text)
if bukvi:
# Text resshifrovalsya v bukvi:
print "Kluch:", a
print sum(text)
razprinpui(text)