-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecipher.py
More file actions
44 lines (40 loc) · 1.3 KB
/
Copy pathDecipher.py
File metadata and controls
44 lines (40 loc) · 1.3 KB
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
class Decipher:
def __init__(self, data='', password=''):
self.data = data
self.password = password
self.result = False
def decipher_password(self):
# For authentication(Deciphering your password)..
helper = self.data.split('*/*/')
count, separator, compare, helper_list = 1, '', '', []
for i in helper[0]:
if i == '%':
helper_list.append(int(separator) - count)
count += 1
separator = ''
continue
separator += i
for i in helper_list:
compare += chr(i)
if compare == self.password:
self.result = True
return self.result, helper
def decipher_message(self, helper):
# Deciphering your message
helper_list = []
helper_msg = helper[1].split('@*@')
message = str(helper_msg[0])
size = int(helper_msg[1])
separator, deciphered = '', ''
for i in message:
if i == '@':
helper_list.append(int(separator) - size)
size -= 1
separator = ''
continue
separator += i
for i in helper_list:
deciphered += chr(i)
return deciphered
if __name__ == '__main__':
pass