File tree Expand file tree Collapse file tree 2 files changed +4
-19
lines changed Expand file tree Collapse file tree 2 files changed +4
-19
lines changed Original file line number Diff line number Diff line change 1
- import math
2
-
3
1
LETTER_FREQUENCIES_DICT = {
4
2
"A" : 8.12 ,
5
3
"B" : 1.49 ,
@@ -218,20 +216,7 @@ def find_key_from_vigenere_cipher(ciphertext: str) -> str:
218
216
# print(key)
219
217
220
218
221
- # ---------- TESTS ----------
222
-
223
- class Test :
224
- def test_index_of_coincidence (self ):
225
- ic = index_of_coincidence ({'a' : 50 , 'b' : 50 }, 50 )
226
- assert math .isclose (ic , 2.0 )
227
219
228
- def test_calculate_indexes_of_coincidence (self ):
229
- ciphertext = "hellothere"
230
- result = calculate_indexes_of_coincidence (ciphertext , 2 )
231
- assert result == [0.1 , 0.3 ]
232
-
233
- def test_friedman_method (self ):
234
- ciphertext = "asqsfdybpypvhftnboexqumfsnglmcstyefv"
235
- result = friedman_method (ciphertext , 5 )
236
- assert result == 3
220
+ # ---------- TESTS ----------
221
+ # def test_index_of_coincidence(f)
237
222
Original file line number Diff line number Diff line change 4
4
5
5
class TestBreakVigenere (unittest .TestCase ):
6
6
def test_index_of_coincidence (self ):
7
- dictionary = {'a' : 5 , 'b' : 1 , 'c' : 4 }
7
+ dictionary = {"a" : 5 , "b" : 1 , "c" : 4 }
8
8
ic = index_of_coincidence (dictionary , 100 )
9
- self .assertAlmostEqual (ic , 0.0032323232323232 )
9
+ self .assertAlmostEqual (ic , 0.0032323232323232 )
You can’t perform that action at this time.
0 commit comments