diff options
-rw-r--r-- | cryptography/bindings/openssl/api.py | 4 | ||||
-rw-r--r-- | cryptography/primitives/hashes.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 84458367..cf3389d2 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -141,12 +141,12 @@ class API(object): def supports_hash(self, hash_cls): return (self.ffi.NULL != - self.lib.EVP_get_digestbyname(hash_cls.name)) + self.lib.EVP_get_digestbyname(hash_cls.name.encode("ascii"))) def create_hash_context(self, hashobject): ctx = self.lib.EVP_MD_CTX_create() ctx = self.ffi.gc(ctx, self.lib.EVP_MD_CTX_destroy) - evp_md = self.lib.EVP_get_digestbyname(hashobject.name) + evp_md = self.lib.EVP_get_digestbyname(hashobject.name.encode("ascii")) assert evp_md != self.ffi.NULL res = self.lib.EVP_DigestInit_ex(ctx, evp_md, self.ffi.NULL) assert res != 0 diff --git a/cryptography/primitives/hashes.py b/cryptography/primitives/hashes.py index f5cf135a..d74287f9 100644 --- a/cryptography/primitives/hashes.py +++ b/cryptography/primitives/hashes.py @@ -43,6 +43,6 @@ class BaseHash(object): class SHA1(BaseHash): - name = b"sha1" + name = "sha1" digest_size = 20 block_size = 64 |