forked from DCRasPi/RasPi-Encryption
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyGenerator.py
More file actions
90 lines (53 loc) · 1.46 KB
/
KeyGenerator.py
File metadata and controls
90 lines (53 loc) · 1.46 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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import random
import math
def KeyGenerator():
KeyListDict = {}
i = 0
a = 0
while not i == 4:
TempKeyList = []
while not a == 4:
tempRandom = random.randrange(1, 16)
keytemp = hex(tempRandom)[2:]
TempKeyList.append(keytemp)
a = a + 1
KeyListDict[i] = "".join(TempKeyList)
a = 0
i = i + 1
return KeyListDict
def KeyValue(KeyList, component):
x = int(KeyList[component], 16)
return x
def OrderToKeyLocation(Key):
n = 0
while not n == 4:
for value in Key[n]:
KeyList.append(value)
n = n + 1
return KeyList
def OrderByKeyList(Key):
i = 0
templist = []
orderedhexlist = []
while not i == 4:
templist.append(KeyValue(Key, i))
i = i + 1
templist = sorted(templist, reverse=True)
for value in templist:
orderedhexlist.append(hex(value)[2:])
return orderedhexlist
def ConvertToList(Key):
Keylist = []
i = 0
n = 0
while not i == 4:
n = 0
while not n > 3:
if n == 3:
tempstring = Key[i][n:]
else:
tempstring = Key[i][n:(n+1)]
Keylist.append(tempstring)
n = n + 1
i = i + 1
return Keylist