File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import math
2-
31LETTER_FREQUENCIES_DICT = {
42 "A" : 8.12 ,
53 "B" : 1.49 ,
@@ -218,20 +216,7 @@ def find_key_from_vigenere_cipher(ciphertext: str) -> str:
218216 # print(key)
219217
220218
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 )
227219
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)
237222
Original file line number Diff line number Diff line change 44
55class TestBreakVigenere (unittest .TestCase ):
66 def test_index_of_coincidence (self ):
7- dictionary = {'a' : 5 , 'b' : 1 , 'c' : 4 }
7+ dictionary = {"a" : 5 , "b" : 1 , "c" : 4 }
88 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