-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA2_output.txt
240 lines (194 loc) · 7.93 KB
/
A2_output.txt
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
----------------------------------------
Start of Task 1: Utilities Testing
Testing get_positions:
str1 = One Must Acknowledge With Cryptography No Amount of Violence Will Ever Solve a Math Problem.
get_positions(str1,get_base("upper")) --> [['O', 0], ['M', 4], ['A', 9], ['W', 21], ['C', 26], ['N', 39], ['A', 42], ['V', 52], ['W', 61], ['E', 66], ['S', 71], ['M', 79], ['P', 84]]
get_positions(str1,get_base("vwxyz")) --> [['w', 14], ['y', 28], ['y', 37], ['v', 67], ['v', 74]]
get_positions(str1,get_base("special")) --> [['.', 91]]
Testing clean_text:
clean_text(str1,get_base("upper")) = ne ust cknowledge ith ryptography o mount of iolence ill ver olve a ath roblem.
clean_text(str1,get_base("lower")) = O M A W C N A V W E S M P.
clean_text(str1,"abcdefghij") = On Must Aknowl Wt Cryptorpy No Amount o Voln Wll Evr Solv Mt Prolm.
clean_text(str1," \n") = OneMustAcknowledgeWithCryptographyNoAmountofViolenceWillEverSolveaMathProblem.
Testing insert_positions:
One Must Acknowledge With Cryptography No Amount of Violence Will Ever Solve a Math Problem.
One Must Acknowledge With Cryptography No Amount of Violence Will Ever Solve a Math Problem.
One Must Acknowledge With Cryptography No Amount of Violence Will Ever Solve a Math Problem.
One Must Acknowledge With Cryptography No Amount of Violence Will Ever Solve a Math Problem.
Testing text_to_blocks:
['Cryp', 'togr', 'aphy', ' is ', 'the ', 'fun ', 'part', ' of ', 'math']
['Crypt', 'ograp', 'hy is', ' the ', 'fun p', 'art o', 'f mat', 'h']
['Cryptog', 'raphy i', 's the f', 'un part', ' of mat', 'h']
['Cryptogr', 'aphy is ', 'the fun ', 'part of ', 'mathqqqq']
['Cryptograp', 'hy is the ', 'fun part o', 'f mathxxxx']
Testing shift_string:
tography is the fun part of mathCryp
mathCryptography is the fun part of
ography is the fun part of mathCrypt
mathCryptography is the fun part of
graphy is the fun part of mathCrypto
is the fun part of mathCryptography
phy is the fun part of mathCryptogra
Testing index_2d:
list1 = [[1, 2, 3], [4, 5], [6, 7, 8, 9, 10], [11], [12, 13]]
2 is at (0, 1)
5 is at (1, 1)
6 is at (2, 0)
11 is at (3, 0)
12 is at (4, 0)
18 is at (-1, -1)
End of Task 1: Utilities Testing
----------------------------------------
----------------------------------------
Start of Task 2: Block Rotation Cipher
Testing adjust Key:
(4,3.5) --> (0, 0)
[4, 5] --> (0, 0)
10 --> (0, 0)
(-2,1) --> (0, 0)
(5,7) --> (5, 2)
(3,11) --> (3, 2)
(7,-6) --> (7, 1)
(11,4) --> (11, 4)
Testing encryption and decryption:
Key = (4, 3)
plaintext = abcdefghijklmnopqrstuvwxyz
After encryption: dabchefglijkpmnotqrsxuvwqyzq
After Decryption: abcdefghijklmnopqrstuvwxyz
Key = (10, 6)
plaintext =
The internet, our greatest tool of emancipation, has been transformed into the most dangerous facilitator of totalitarianism we have ever seen
After encryption:
ternThe inr gret, ou tooeatestmancl of en, hipation tras beemed ansforhe minto tngerost dacilious faof ttator ariaotalite hanism wr seve eveqqqqenqqqq
After Decryption:
The internet, our greatest tool of emancipation, has been transformed into the most dangerous facilitator of totalitarianism we have ever seen
Key = (8, 5)
plaintext =
One must acknowledge with cryptography no amount of violence will ever solve a math problem.
After encryption:
ustOne mowl acknwitedge ptoh cryy ngraphunto amoiol of vwilence r sl evea molve robath pqqqlem.q
After Decryption:
One must acknowledge with cryptography no amount of violence will ever solve a math problem.
Testing Cryptanalysis:
key = (8, 5)
plaintext validated
key = (9, 7)
plaintext validated
key = (15, 11)
plaintext validated
key = (7, 6)
plaintext validated
key = (12, 8)
plaintext validated
End of Task 2: Block Rotation Testing
----------------------------------------
----------------------------------------
Start of Task 3: Playfair Square Cipher
--------- Testing _format_playfair:
Light Lightx
lesson lesxon
door door
floor floxrx
window vxindovx
Widow VXidovvx
Are you happy? Are you hapxy?x
What?! Angry!! VXhat?! Angry!!
Wow!! That is wonderful! VXovv!! That is vvonderful!x
-------- Testing _restore_word_playfair:
a --> a A --> A
road --> road ROAD --> ROAD
ox --> ox OX --> OX
fox --> fox FOX --> FOX
anxious --> anxious ANXIOUS --> ANXIOUS
doxr --> door DOXR --> DOOR
exl --> eel EXL --> EEL
afxix --> affix AFXIX --> AFFIX
excesx --> excess EXCESX --> EXCESS
foxtbalx --> football FOXTBALX --> FOOTBALL
Football --> Football FOOTBALL --> FOOTBALL
England --> England ENGLAND --> ENGLAND
--------- Testing _restore_playfair:
Before: Lesxon Lightx
After : Lesson Light
Before: vxindovx floxrx
After : window floor
Before: VXidovv floxr
After : Widow floor
Before: Is it why or what?
After : Is it why or what?
-------- Testing Encryption/Decryption:
plaintext = Light
ciphertext = Mjfguy
plaintext = Light
plaintext = lesson
ciphertext = biuqpo
plaintext = lesson
plaintext = door
ciphertext = tapz
plaintext = door
plaintext = floor
ciphertext = iqnyvq
plaintext = floor
plaintext = window
ciphertext = xnhmtaxn
plaintext = window
plaintext = Widow
ciphertext = XNejnzxn
plaintext = Widow
plaintext = Are you happy?
ciphertext = Pcg bnt ennqq?y
plaintext = Are you happy?
plaintext = What?! Angry!!
ciphertext = XNend?! Oohzq!!
plaintext = What?! Angry!!
plaintext = Wow!! That is wonderful!
ciphertext = XNnzz!! Uenj gu rznaufchsx!y
plaintext = Wow!! That is wonderful!
------------ Testing encrypt/decrypt over files:
Encryption validated
Decryption validated
End of Task 3: Playfair Cipher Testing
----------------------------------------
----------------------------------------
Start of Task 4: Columnar Transposition Cipher
----------- Testing get_keyOrder_columnarTrans:
Key order for = []
Key order for r = [0]
Key order for ? = [0]
Key order for RAINY? = [1, 2, 3, 0, 4, 5]
Key order for dad = [1, 0]
Key order for face = [1, 2, 3, 0]
Key order for Face = [0, 1, 2, 3]
Key order for apple = [0, 3, 2, 1]
Key order for good day = [3, 4, 2, 0, 1, 5]
Key order for German = [0, 4, 1, 3, 5, 2]
Testing Encryption/Decryption:
key =
plaintext =
ABC
Error(e_ct): invalid key
ciphertext =
Error(d_ct): invalid key
plaintext2 =
key = German
plaintext =
DEFENDEASTERNWALLOFTHECASTLE
ciphertext =
DENFSNELCqEAWTTETLEEDROAqFSAHL
plaintext2 =
DEFENDEASTERNWALLOFTHECASTLE
key = Truth Seeker
plaintext =
The story was very pretty and interesting, especially at the point where the rivals suddenly recognized one another; and the ladies looked agitated.
"Charming!" said Anna Pavlovna with an inquiring glance at the little princess.
"Charming!" whispered the little princess, sticking the needle into her work as if to testify that the interest and fascination of the story prevented her from going on with it.
ciphertext =
oyd iierl yeh eotm dongtp "!e lsgeotarsoyd ohrpinapes rd elk eiAvi ghrC" de, tirete cfphiiTa teeynedoea ia" !awunicr iei ino sieaae vfoyrn glotseora
ednnnnleihw tpsh nkst sitrentt rntc he alzthoari lante. gr tsn lwohea nregtwet,
lihucn;dd.g naqalnahh rte tathtn herg.hstr satrdgan egC "Piict emsl nce hifi nt se rn seaseth vnio tlt aavhials net eidrtttfoot mi evy eptwi enndsihsa tre tsip ickee fy ndit now
plaintext2 =
The story was very pretty and interesting, especially at the point where the rivals suddenly recognized one another; and the ladies looked agitated.
"Charming!" said Anna Pavlovna with an inquiring glance at the little princess.
"Charming!" whispered the little princess, sticking the needle into her work as if to testify that the interest and fascination of the story prevented her from going on with it.
End of Task 4: Columnar Transposition Cipher Testing
----------------------------------------