summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.rst6
1 files changed, 3 insertions, 3 deletions
diff --git a/README.rst b/README.rst
index a6708cf..0f4fc33 100644
--- a/README.rst
+++ b/README.rst
@@ -89,15 +89,15 @@ Maxmimum Password Length
The bcrypt algorithm only handles passwords up to 72 characters, any characters
beyond that are ignored. To work around this, a common approach is to hash a
-password with a cryptographic hash (such as ``sha256``) and then hex or base64
-encoding it to prevent NULL byte problems before hashing the result with
+password with a cryptographic hash (such as ``sha256``) and then base64
+encode it to prevent NULL byte problems before hashing the result with
``bcrypt``:
.. code:: pycon
>>> password = b"an incredibly long password" * 10
>>> hashed = bcrypt.hashpw(
- ... hashlib.sha256(password).hexdigest(),
+ ... base64.b64encode(hashlib.sha256(password).digest()),
... bcrypt.gensalt()
... )