summaryrefslogtreecommitdiff
path: root/src/bcrypt
diff options
context:
space:
mode:
authorEugene <gish.ee18@gmail.com>2020-08-17 14:44:23 +0300
committerGitHub <noreply@github.com>2020-08-17 07:44:23 -0400
commit0b88cb2273b564a4193ac11813347484fc1cec7c (patch)
tree3cb0b567aa4a792acd17ab25d1bd9434a9e8655d /src/bcrypt
parenta571ad475d90e64e63286245dca19f4f8cfdcbd6 (diff)
downloadpy-bcrypt-git-0b88cb2273b564a4193ac11813347484fc1cec7c.tar.gz
Drop six dependency (#225)
* Drop six dependency * Resolve formatting error
Diffstat (limited to 'src/bcrypt')
-rw-r--r--src/bcrypt/__init__.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/bcrypt/__init__.py b/src/bcrypt/__init__.py
index 0a8cc05..275828f 100644
--- a/src/bcrypt/__init__.py
+++ b/src/bcrypt/__init__.py
@@ -20,8 +20,6 @@ import os
import re
import warnings
-import six
-
from . import _bcrypt # type: ignore
from .__about__ import (
__author__,
@@ -76,8 +74,8 @@ def gensalt(rounds: int = 12, prefix: bytes = b"2b") -> bytes:
def hashpw(password: bytes, salt: bytes) -> bytes:
- if isinstance(password, six.text_type) or isinstance(salt, six.text_type):
- raise TypeError("Unicode-objects must be encoded before hashing")
+ if isinstance(password, str) or isinstance(salt, str):
+ raise TypeError("Strings must be encoded before hashing")
if b"\x00" in password:
raise ValueError("password may not contain NUL bytes")
@@ -114,10 +112,8 @@ def hashpw(password: bytes, salt: bytes) -> bytes:
def checkpw(password: bytes, hashed_password: bytes) -> bool:
- if isinstance(password, six.text_type) or isinstance(
- hashed_password, six.text_type
- ):
- raise TypeError("Unicode-objects must be encoded before checking")
+ if isinstance(password, str) or isinstance(hashed_password, str):
+ raise TypeError("Strings must be encoded before checking")
if b"\x00" in password or b"\x00" in hashed_password:
raise ValueError(
@@ -139,8 +135,8 @@ def kdf(
rounds: int,
ignore_few_rounds: bool = False,
) -> bytes:
- if isinstance(password, six.text_type) or isinstance(salt, six.text_type):
- raise TypeError("Unicode-objects must be encoded before hashing")
+ if isinstance(password, str) or isinstance(salt, str):
+ raise TypeError("Strings must be encoded before hashing")
if len(password) == 0 or len(salt) == 0:
raise ValueError("password and salt must not be empty")