File size: 4,110 Bytes
92eca72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
coding = {
    "e": "000",
    "s": "0010",
    "r": "0011",
    "o": "0100",
    "'": "010100000",
    "P": "010100001",
    "S": "01010001",
    "T": "01010010",
    "A": "01010011",
    ";": "01010100000",
    "Q": "0101010000100",
    "]": "01010100001010",
    "+": "010101000010110",
    "*": "01010100001011100",
    "^": "010101000010111010",
    "\u007f": "0101010000101110110000",
    "\u001f": "01010100001011101100010",
    "\u001e": "01010100001011101100011",
    "<": "010101000010111011001",
    "\u000f": "01010100001011101101000",
    "\u000e": "01010100001011101101001",
    "\r": "01010100001011101101010",
    "\f": "01010100001011101101011",
    "\u001d": "01010100001011101101100",
    "\u001c": "01010100001011101101101",
    "\u001b": "01010100001011101101110",
    "\u001a": "01010100001011101101111",
    "\u0017": "01010100001011101110000",
    "\u0016": "01010100001011101110001",
    "\u0015": "01010100001011101110010",
    "\u0014": "01010100001011101110011",
    "\u0013": "01010100001011101110100",
    "\u0012": "01010100001011101110101",
    "\u0019": "01010100001011101110110",
    "\u0018": "01010100001011101110111",
    "\u000b": "01010100001011101111000",
    "\b": "01010100001011101111001",
    "\u0005": "01010100001011101111010",
    "\u0004": "01010100001011101111011",
    "\u0003": "01010100001011101111100",
    "\u0002": "01010100001011101111101",
    "\u0001": "01010100001011101111110",
    "\u0000": "01010100001011101111111",
    "~": "0101010000101111",
    "%": "010101000011",
    "q": "0101010001",
    "x": "010101001",
    "V": "01010101000",
    ":": "01010101001",
    "6": "0101010101",
    "9": "010101011",
    "\"": "010101100",
    "-": "010101101",
    "=": "01010111",
    "g": "010110",
    "1": "01011100",
    "B": "010111010",
    "7": "0101110110",
    "z": "0101110111",
    "M": "010111100",
    "J": "0101111010",
    "L": "0101111011",
    "4": "0101111100",
    "U": "0101111101",
    "}": "010111111000000",
    "{": "010111111000001",
    "X": "01011111100001",
    "/": "0101111110001",
    "$": "0101111110010",
    "Z": "0101111110011",
    "K": "01011111101",
    "O": "0101111111",
    "n": "0110",
    "i": "0111",
    "d": "10000",
    "p": "100010",
    "f": "100011",
    "t": "1001",
    "l": "10100",
    ".": "1010100",
    "v": "1010101",
    "0": "10101100",
    "k": "10101101",
    "5": "1010111000",
    "8": "1010111001",
    "W": "1010111010",
    "3": "1010111011",
    "\n": "10101111",
    "a": "1011",
    " ": "110",
    "h": "11100",
    "m": "111010",
    "D": "1110110000",
    "F": "1110110001",
    "G": "1110110010",
    "E": "1110110011",
    "N": "1110110100",
    "H": "1110110101",
    "C": "111011011",
    "b": "1110111",
    "u": "111100",
    ",": "1111010",
    "(": "1111011000",
    ")": "1111011001",
    "I": "111101101",
    "R": "1111011100",
    "Y": "111101110100",
    "!": "1111011101010000",
    "#": "11110111010100010",
    "|": "1111011101010001100",
    "\u0011": "11110111010100011010000",
    "\u0010": "11110111010100011010001",
    "\u0007": "11110111010100011010010",
    "\u0006": "11110111010100011010011",
    "@": "1111011101010001101010",
    "`": "1111011101010001101011",
    ">": "11110111010100011011",
    "_": "111101110101000111",
    "?": "1111011101010010",
    "\\": "1111011101010011",
    "&": "111101110101010",
    "[": "111101110101011",
    "\t": "1111011101011",
    "j": "11110111011",
    "2": "111101111",
    "w": "1111100",
    "y": "1111101",
    "c": "111111"
}
decoding = {v: k for k, v in coding.items()}
def decimal_to_binary(n): 
    return bin(n)[2:]
def binary_to_decimal(n):
    return int(n,2)
def convert_to_binary(text):
    binary_text = ""
    for char in text:
        binary_text += coding[char]
    return binary_text
def convert_to_text(binary):
    text = ""
    chunk = ""
    for i in binary:
        chunk += i
        if chunk in decoding:
            text += decoding[chunk]
            chunk = ""
    return text
t = ""
for i in range(128):
    t+="b"+coding[chr(i)]+"\n"
with open("list.txt", "w") as f:
    f.write(t)