diff options
author | Determinant <ted.sybil@gmail.com> | 2019-08-06 21:34:31 -0400 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2019-08-06 21:34:31 -0400 |
commit | 010b65fe1b3991a4605ca5d9f780cbe6021d685a (patch) | |
tree | 45a5550d6a4ac979e1734df8e6bad4b55906da2f | |
parent | 4b43cf54640e56a48c2536600b47c5a2c4a1b94b (diff) |
...
-rw-r--r-- | README.rst | 2 | ||||
-rw-r--r-- | ethy.py | 3 |
2 files changed, 4 insertions, 1 deletions
@@ -28,7 +28,7 @@ Install .. code-block:: bash git clone https://github.com/Determinant/ethy.py - pip install --user ethy.py/ + pip3 install --user ethy.py/ Example ------- @@ -117,6 +117,9 @@ def encrypt(passwd=None, salt=None, n=None, r=None, p=None, dklen=None, iv=None, def show_entropy(bytes, prompt="pass"): pwd_len = len(bytes) pwd_ent = entropy(bytes) + if pwd_len < 2: + err.write("{} is too short!\n".format(prompt)) + sys.exit(1) err.write("{0} length = {1} bytes\n" "{0} entropy = {2}, {3:.2f}%\n".format(prompt, pwd_len, pwd_ent, pwd_ent / log(pwd_len, 2) * 100)) |