aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.rst2
-rw-r--r--ethy.py3
2 files changed, 4 insertions, 1 deletions
diff --git a/README.rst b/README.rst
index 133be3e..ebe612e 100644
--- a/README.rst
+++ b/README.rst
@@ -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
-------
diff --git a/ethy.py b/ethy.py
index cf5e932..a480d1e 100644
--- a/ethy.py
+++ b/ethy.py
@@ -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))