Skip to content

Commit 851fc3e

Browse files
committed
made find_key_from_vigenere_cipher
1 parent ed7c9b5 commit 851fc3e

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

ciphers/break_vigenere.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
LETTER_FREQUENCIES_DICT = {
2+
'A': 8.12, 'B': 1.49, 'C': 2.71, 'D': 4.32, 'E': 12.02, 'F': 2.3, 'G': 2.03,
3+
'H': 5.92, 'I': 7.31, 'J': 0.1, 'K': 0.69, 'L': 3.92, 'M': 2.61,
4+
'N': 6.95, 'O': 7.68, 'P': 1.82, 'Q': 0.11, 'R': 6.02, 'S': 6.28,
5+
'T': 9.10, 'U': 2.88, 'V': 1.11, 'W': 2.09, 'X': 0.17, 'Y': 2.11, 'Z': 0.07
6+
}
7+
8+
LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
9+
10+
11+
def find_key_from_vigenere_cipher(ciphertext: str) -> str:
12+
clean_ciphertext = list()
13+
for symbol in ciphertext:
14+
if symbol in LETTERS:
15+
clean_ciphertext.append(symbol.upper())
16+
17+
clean_ciphertext = "".join(clean_ciphertext)
18+
19+
key = "" # todo replace with function
20+
return key

0 commit comments

Comments
 (0)