-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEncoder.py
More file actions
39 lines (30 loc) · 779 Bytes
/
Encoder.py
File metadata and controls
39 lines (30 loc) · 779 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class Encoder:
def __init__(self, a, b, c, steps = 5):
self.a = a[0]
self.b = b[0]
self.c = c[0]
self.add = [a[1], b[1], c[1]]
self.steps = steps
def enc(self):
import time as t
a = self.a
b = self.b
c = self.c
def do_over(steps, x, do_a, do_b, do_c):
memory = x
step = 1
while step <= steps:
memory = int((do_a * (memory ** 2)) + (do_b * memory) + do_c)
step += 1
return memory
to_be_encoded = input("What do you wish to be encoded master?: ")
start = t.time()
for i in to_be_encoded:
k = int(ord(i))
out = do_over(self.steps, k, a, b, c)
a += self.add[0]
b += self.add[1]
c += self.add[2]
print(" " + str(out))
end = t.time()
print("\n Total time:", end - start, "seconds")