forked from DCRasPi/RasPi-Encryption
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringPair.py
More file actions
54 lines (28 loc) · 899 Bytes
/
StringPair.py
File metadata and controls
54 lines (28 loc) · 899 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import math
def KeyPairs(string):
Char1 = string[0:1]
Char2 = string[1:]
Bintemp1 = bin(ord(Char1))
Bintemp2 = bin(ord(Char2))
Bin1 = (Bintemp1[0:1] + Bintemp1[2:])
Bin2 = (Bintemp2[0:1] + Bintemp2[2:])
while len(Bin1) < 8:
Bin1 = '0' + Bin1
while len(Bin2) < 8:
Bin2 = '0' + Bin2
BinaryString = (Bin1 + Bin2)
return BinaryString
def ConvertToTable(BinaryString): #Joe says I should make a comment
#No-one listens to Joe anyway
KeyBinDict = {}
i = 0
a = 0
while not i == 4:
TempKeyList = []
while not a == 4:
TempKeyList.append((BinaryString[a:(a+1)]))
a = a + 1
KeyBinDict[i] = TempKeyList
a = 0
i = i + 1
return KeyBinDict