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
155
156
157
|
from sys import argv
from stdlib import *
"""
map: Dictionary mapping single character keys to special characters to use for "fancy font".
"""
map = {
'`': '`',
'~': '`',
'1': '¡',
'!': '⁄',
'2': '™',
'@': '€',
'3': '£',
'#': '‹',
'4': '¢',
'$': '›',
'5': '∞',
'%': 'fi',
'6': '§',
'^': 'fl',
'7': '¶',
'&': '‡',
'8': '•',
'*': '°',
'9': 'ª',
'(': '·',
'0': 'º',
')': '‚',
'-': '−',
'_': '—',
'=': '≠',
'+': '±',
'q': 'œ',
'Q': 'Œ',
'w': '∑',
'W': '„',
'e': '´',
'E': '´',
'r': '®',
'R': '‰',
't': '†',
'T': 'ˇ',
'y': '¥',
'Y': 'Á',
'u': '¨',
'U': '¨',
'i': 'ˆ',
'I': 'ˆ',
'o': 'ø',
'O': 'Ø',
'p': 'π',
'P': '∏',
'[': '“',
'{': '”',
']': '‘',
'}': '’',
'\\': '«',
'|': '»',
'a': 'å',
'A': 'Å',
's': 'ß',
'S': 'Í',
'd': '∂',
'D': 'Î',
'f': 'ƒ',
'F': 'Ï',
'g': '©',
'G': '˝',
'h': '˙',
'H': '',
'j': '∆',
'J': 'Ô',
'k': '˚',
'K': '',
'l': '¬',
'L': 'Ò',
';': '…',
':': 'Ú',
'z': 'Ω',
'Z': '¸',
'x': '≈',
'X': '˛',
'c': 'ç',
'C': 'Ç',
'v': '√',
'V': '◊',
'b': '∫',
'B': 'ı',
'n': '˜',
'N': '˜',
'm': 'µ',
'M': 'Â',
',': '≤',
'<': '≤',
'.': '≥',
'>': '˘',
'/': '÷',
'?': '¿'
}
def main():
if len(argv) == 1: # no arguments
transmode = keepasks("What is the transfer mode?(normal or reverse)", inputter=askinput)
else:
if "normal" not in argv[1] and "reverse" not in argv[1]:
printerror("Please input normal or reverse")
exit(1)
else:
transmode = argv[1]
if "normal" in transmode.lower():
transmode = 0
normalMode(in_data)
elif "reverse" in transmode.lower():
transmode = 1
reverseMode(in_data)
def normalMode(data: str):
"""
normalMode takes a string data as input, iterates through each character,
looks up the corresponding substitution character in the map,
and concatenates the substituted characters to build the output string out_data.
It prints a message indicating normal mode was selected,
performs the character substitution,
and calls the outputter function to print the output string.
This implements a simple letter substitution cipher in normal mode.
"""
global in_data, out_data
aprintf("Mode selected: Normal Mode")
for i in data:
try:
tmp = list(map.keys())[list(map.values()).index(i)]
except ValueError:
tmp = i
printf(tmp)
def reverseMode(data: str):
global in_data, out_data
aprintf("Mode selected: Reverse Mode")
for i in data:
try:
tmp = map[i]
except KeyError:
tmp = i
printf(tmp)
if __name__ == '__main__':
in_data = keepasks("What is the data you want to transfer?", inputter=askinput)
out_data = ""
main()
|