projects
/
cipher-tools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
68d6bc2
)
Fixed vigenere break tests
author
Neil Smith
<neil.github@njae.me.uk>
Fri, 22 Nov 2013 10:38:09 +0000
(10:38 +0000)
committer
Neil Smith
<neil.github@njae.me.uk>
Fri, 22 Nov 2013 10:38:09 +0000
(10:38 +0000)
break.py
patch
|
blob
|
history
diff --git
a/break.py
b/break.py
index 08b7301e5e6b09d0b85391e911012c9e90b807c0..b97c37dcd27085e70562407560966881064c0b1a 100644
(file)
--- a/
break.py
+++ b/
break.py
@@
-364,10
+364,10
@@
def vigenere_keyword_break(message,
"""Breaks a vigenere cipher using a dictionary and
frequency analysis
"""Breaks a vigenere cipher using a dictionary and
frequency analysis
- >>> vigenere_keyword_break(
keyword_encipher('this is a test message for the
' \
- '
keyword decipherment', 'elephant', 1
), \
+ >>> vigenere_keyword_break(
vigenere_encipher(sanitise('this is a test
' \
+ '
message for the vigenere decipherment'), 'cat'
), \
wordlist=['cat', 'elephant', 'kangaroo']) # doctest: +ELLIPSIS
wordlist=['cat', 'elephant', 'kangaroo']) # doctest: +ELLIPSIS
- ('
elephant', 0.7166585201707
...)
+ ('
cat', 0.4950195952826
...)
"""
best_keyword = ''
best_fit = float("inf")
"""
best_keyword = ''
best_fit = float("inf")
@@
-397,10
+397,10
@@
def vigenere_keyword_break_mp(message,
"""Breaks a vigenere cipher using a dictionary and
frequency analysis
"""Breaks a vigenere cipher using a dictionary and
frequency analysis
- >>> vigenere_keyword_break_mp(
keyword_encipher('this is a test message for the
' \
- '
keyword decipherment', 'elephant', 1
), \
+ >>> vigenere_keyword_break_mp(
vigenere_encipher(sanitise('this is a test
' \
+ '
message for the vigenere decipherment'), 'cat'
), \
wordlist=['cat', 'elephant', 'kangaroo']) # doctest: +ELLIPSIS
wordlist=['cat', 'elephant', 'kangaroo']) # doctest: +ELLIPSIS
- ('
elephant', 0.7166585201707
...)
+ ('
cat', 0.4950195952826
...)
"""
with Pool() as pool:
helper_args = [(message, word, metric, target_counts,
"""
with Pool() as pool:
helper_args = [(message, word, metric, target_counts,