Skip to content

Commit 4feb0b4

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # ciphers/break_vigenere.py
2 parents f1c953d + aca65f8 commit 4feb0b4

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

ciphers/break_vigenere.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import math
2-
31
LETTER_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

ciphers/tests/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
class 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)

0 commit comments

Comments
 (0)