From: Steven Tobin Date: Wed, 7 Jun 2017 11:29:51 +0000 (+0100) Subject: fix bug in entropy calc X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=2883f1b704c17561af37090374ab6fa47fc8b868;p=redacted-XKCD-password-generator.git fix bug in entropy calc --- diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 72c3f88..d3de74b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -23,3 +23,4 @@ Edward Betts Jakub Wilk Dan Rosenbloom Tomas Krizek +Amir Yalon diff --git a/README.rst b/README.rst index 4211806..c59e8f2 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/setup.py b/setup.py index 3c128cb..5f331e9 100644 --- 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', diff --git a/xkcdpass/xkcd_password.py b/xkcdpass/xkcd_password.py index 7f926f9..edb4353 100755 --- a/xkcdpass/xkcd_password.py +++ b/xkcdpass/xkcd_password.py @@ -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")