Fixed bug in Caesar break, added tests.
authorNeil Smith <neil.github@njae.me.uk>
Mon, 7 Oct 2013 12:30:28 +0000 (13:30 +0100)
committerNeil Smith <neil.github@njae.me.uk>
Mon, 7 Oct 2013 12:30:28 +0000 (13:30 +0100)
cipher.py
norms.pyc

index b883abea3cbc32bf81bb37a342efeaf576ffbf02..85de0a52c33b880653b83b573ff87ee109ec2970 100644 (file)
--- a/cipher.py
+++ b/cipher.py
@@ -114,7 +114,7 @@ def caesar_break(message, metric=norms.euclidean_distance, target_frequencies=no
     >>> caesar_break('ibxcsyorsaqcheyklxivoexlevmrimwxsfiqevvmihrsasrxliwyrhecjsppsamrkwleppfmergefifvmhixscsymjcsyqeoixlm')
     (4, 0.3186395289018361)
     >>> caesar_break('jhzhuhfrqilqhgwrdevwudfwuhdvrqlqjwkhqkdylqjvxemhfwhgwrfulwlflvpwkhhasodqdwlrqrisrzhuwkdwmxulglfdovfl')
-    (3, 0.32902042861730835)
+    (3, 0.3290204286173084)
     >>> caesar_break('wxwmaxdgheetgwuxztgptedbgznitgwwhpguxyhkxbmhvvtlbhgteeraxlmhiixweblmxgxwmhmaxybkbgztgwztsxwbgmxgmert')
     (19, 0.4215290123583277)
     >>> caesar_break('yltbbqnqnzvguvaxurorgenafsbezqvagbnornfgsbevpnaabjurersvaquvzyvxrnznazlybequrvfohgriraabjtbaruraprur')
index 540caf5c836c654bd2ccefced84763193e2689c8..97282d756e6b5cee539917570a18e33cb7cd597a 100644 (file)
Binary files a/norms.pyc and b/norms.pyc differ