fix bug in entropy calc
authorSteven Tobin <steventtobin (at) gmail.com>
Wed, 7 Jun 2017 11:29:51 +0000 (12:29 +0100)
committerSteven Tobin <steventtobin (at) gmail.com>
Wed, 7 Jun 2017 11:29:51 +0000 (12:29 +0100)
CONTRIBUTORS
README.rst
setup.py
xkcdpass/xkcd_password.py

index 72c3f88e02e9f7e8061e901f72bb193839933a53..d3de74b543f343b49408e4523b6ce8c4d2a293c5 100644 (file)
@@ -23,3 +23,4 @@ Edward Betts <edward@4angle.com>
 Jakub Wilk <jwilk@jwilk.net>
 Dan Rosenbloom <drosenbloom@logicworks.net>
 Tomas Krizek <tomas.krizek@mailbox.org>
+Amir Yalon <amiryal@users.noreply.github.com>
index 421180671b0da94dada47732d1847fdca099d8df..c59e8f2f04606d3e89e0b4c0b01ea96d79e1fbf3 100644 (file)
@@ -162,6 +162,7 @@ or setting the appropriate environment variable::
 
 Changelog
 =========
+- **1.11.1** Fix bug in entropy calc
 - **1.11.0** Rewrite verbose report to take acrostics etc into account
 - **1.10.0** Switch to EFF wordlist as default (note: decrease in entropy of default length passwords to 77 bits, still at EFF recommendations)
 - **1.9.5** Fix broken test
index 3c128cbc3edebf32571da20c407a2e1e8b663246..5f331e92ff06f97110630a668ecdd2e2ffcf7fc2 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ from setuptools import setup
 
 setup(
     name='xkcdpass',
-    version='1.11.0',
+    version='1.11.1',
     author='Steven Tobin',
     author_email='steventtobin@gmail.com',
     url='https://github.com/redacted/XKCD-password-generator',
index 7f926f986c76f64f61737faf1d6e5739fe23f2ce..edb4353144341366ef6d40e6b61b187bd92b79a0 100755 (executable)
@@ -157,11 +157,13 @@ def verbose_reports(wordlist, options):
 
     if options.acrostic:
         worddict = wordlist_to_worddict(wordlist)
+        numwords = len(options.acrostic)
         length = 0
         for char in options.acrostic:
             length += len(worddict.get(char, []))
     else:
         length = len(wordlist)
+        numwords = options.numwords
 
     bits = math.log(length, 2)
 
@@ -170,10 +172,7 @@ def verbose_reports(wordlist, options):
 
     print("A {0} word password from this list will have roughly "
           "{1} ({2:.2f} * {3}) bits of entropy,"
-          "".format(
-              options.numwords,
-              int(bits * options.numwords),
-              bits, options.numwords)),
+          "".format(numwords, int(bits * numwords), bits, numwords))
     print("assuming truly random word selection.\n")
 
 
git clone https://git.99rst.org/PROJECT