We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Hasher.hexdigest() is documented as returning a str, but returns unicode under python2
It should return a native string under boht py2 and py3


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cryptography/primitives/hashes.py`
Content:
```
1 # Licensed under the Apache License, Version 2.0 (the "License");
2 # you may not use this file except in compliance with the License.
3 # You may obtain a copy of the License at
4 #
5 #    http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10 # implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 
14 from __future__ import absolute_import, division, print_function
15 
16 import abc
17 
18 import binascii
19 
20 import six
21 
22 from cryptography.bindings import _default_api
23 
24 
25 class BaseHash(six.with_metaclass(abc.ABCMeta)):
26     def __init__(self, data=None, api=None, ctx=None):
27         if api is None:
28             api = _default_api
29         self._api = api
30         self._ctx = self._api.create_hash_context(self) if ctx is None else ctx
31         if data is not None:
32             self.update(data)
33 
34     def update(self, data):
35         if isinstance(data, six.text_type):
36             raise TypeError("Unicode-objects must be encoded before hashing")
37         self._api.update_hash_context(self._ctx, data)
38 
39     def copy(self):
40         return self.__class__(ctx=self._copy_ctx())
41 
42     def digest(self):
43         return self._api.finalize_hash_context(self._copy_ctx(),
44                                                self.digest_size)
45 
46     def hexdigest(self):
47         return binascii.hexlify(self.digest()).decode("ascii")
48 
49     def _copy_ctx(self):
50         return self._api.copy_hash_context(self._ctx)
51 
52 
53 class SHA1(BaseHash):
54     name = "sha1"
55     digest_size = 20
56     block_size = 64
57 
58 
59 class SHA224(BaseHash):
60     name = "sha224"
61     digest_size = 28
62     block_size = 64
63 
64 
65 class SHA256(BaseHash):
66     name = "sha256"
67     digest_size = 32
68     block_size = 64
69 
70 
71 class SHA384(BaseHash):
72     name = "sha384"
73     digest_size = 48
74     block_size = 128
75 
76 
77 class SHA512(BaseHash):
78     name = "sha512"
79     digest_size = 64
80     block_size = 128
81 
82 
83 class RIPEMD160(BaseHash):
84     name = "ripemd160"
85     digest_size = 20
86     block_size = 64
87 
88 
89 class Whirlpool(BaseHash):
90     name = "whirlpool"
91     digest_size = 64
92     block_size = 64
93 
94 
95 class MD5(BaseHash):
96     name = "md5"
97     digest_size = 16
98     block_size = 64
99
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cryptography/primitives/hashes.py b/cryptography/primitives/hashes.py
--- a/cryptography/primitives/hashes.py
+++ b/cryptography/primitives/hashes.py
@@ -44,7 +44,7 @@
                                                self.digest_size)
 
     def hexdigest(self):
-        return binascii.hexlify(self.digest()).decode("ascii")
+        return str(binascii.hexlify(self.digest()).decode("ascii"))
 
     def _copy_ctx(self):
         return self._api.copy_hash_context(self._ctx)

{"golden_diff": "diff --git a/cryptography/primitives/hashes.py b/cryptography/primitives/hashes.py\n--- a/cryptography/primitives/hashes.py\n+++ b/cryptography/primitives/hashes.py\n@@ -44,7 +44,7 @@\n                                                self.digest_size)\n \n     def hexdigest(self):\n-        return binascii.hexlify(self.digest()).decode(\"ascii\")\n+        return str(binascii.hexlify(self.digest()).decode(\"ascii\"))\n \n     def _copy_ctx(self):\n         return self._api.copy_hash_context(self._ctx)\n", "issue": "Hasher.hexdigest() is documented as returning a str, but returns unicode under python2\nIt should return a native string under boht py2 and py3\n\n", "before_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import, division, print_function\n\nimport abc\n\nimport binascii\n\nimport six\n\nfrom cryptography.bindings import _default_api\n\n\nclass BaseHash(six.with_metaclass(abc.ABCMeta)):\n    def __init__(self, data=None, api=None, ctx=None):\n        if api is None:\n            api = _default_api\n        self._api = api\n        self._ctx = self._api.create_hash_context(self) if ctx is None else ctx\n        if data is not None:\n            self.update(data)\n\n    def update(self, data):\n        if isinstance(data, six.text_type):\n            raise TypeError(\"Unicode-objects must be encoded before hashing\")\n        self._api.update_hash_context(self._ctx, data)\n\n    def copy(self):\n        return self.__class__(ctx=self._copy_ctx())\n\n    def digest(self):\n        return self._api.finalize_hash_context(self._copy_ctx(),\n                                               self.digest_size)\n\n    def hexdigest(self):\n        return binascii.hexlify(self.digest()).decode(\"ascii\")\n\n    def _copy_ctx(self):\n        return self._api.copy_hash_context(self._ctx)\n\n\nclass SHA1(BaseHash):\n    name = \"sha1\"\n    digest_size = 20\n    block_size = 64\n\n\nclass SHA224(BaseHash):\n    name = \"sha224\"\n    digest_size = 28\n    block_size = 64\n\n\nclass SHA256(BaseHash):\n    name = \"sha256\"\n    digest_size = 32\n    block_size = 64\n\n\nclass SHA384(BaseHash):\n    name = \"sha384\"\n    digest_size = 48\n    block_size = 128\n\n\nclass SHA512(BaseHash):\n    name = \"sha512\"\n    digest_size = 64\n    block_size = 128\n\n\nclass RIPEMD160(BaseHash):\n    name = \"ripemd160\"\n    digest_size = 20\n    block_size = 64\n\n\nclass Whirlpool(BaseHash):\n    name = \"whirlpool\"\n    digest_size = 64\n    block_size = 64\n\n\nclass MD5(BaseHash):\n    name = \"md5\"\n    digest_size = 16\n    block_size = 64\n", "path": "cryptography/primitives/hashes.py"}], "after_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import, division, print_function\n\nimport abc\n\nimport binascii\n\nimport six\n\nfrom cryptography.bindings import _default_api\n\n\nclass BaseHash(six.with_metaclass(abc.ABCMeta)):\n    def __init__(self, data=None, api=None, ctx=None):\n        if api is None:\n            api = _default_api\n        self._api = api\n        self._ctx = self._api.create_hash_context(self) if ctx is None else ctx\n        if data is not None:\n            self.update(data)\n\n    def update(self, data):\n        if isinstance(data, six.text_type):\n            raise TypeError(\"Unicode-objects must be encoded before hashing\")\n        self._api.update_hash_context(self._ctx, data)\n\n    def copy(self):\n        return self.__class__(ctx=self._copy_ctx())\n\n    def digest(self):\n        return self._api.finalize_hash_context(self._copy_ctx(),\n                                               self.digest_size)\n\n    def hexdigest(self):\n        return str(binascii.hexlify(self.digest()).decode(\"ascii\"))\n\n    def _copy_ctx(self):\n        return self._api.copy_hash_context(self._ctx)\n\n\nclass SHA1(BaseHash):\n    name = \"sha1\"\n    digest_size = 20\n    block_size = 64\n\n\nclass SHA224(BaseHash):\n    name = \"sha224\"\n    digest_size = 28\n    block_size = 64\n\n\nclass SHA256(BaseHash):\n    name = \"sha256\"\n    digest_size = 32\n    block_size = 64\n\n\nclass SHA384(BaseHash):\n    name = \"sha384\"\n    digest_size = 48\n    block_size = 128\n\n\nclass SHA512(BaseHash):\n    name = \"sha512\"\n    digest_size = 64\n    block_size = 128\n\n\nclass RIPEMD160(BaseHash):\n    name = \"ripemd160\"\n    digest_size = 20\n    block_size = 64\n\n\nclass Whirlpool(BaseHash):\n    name = \"whirlpool\"\n    digest_size = 64\n    block_size = 64\n\n\nclass MD5(BaseHash):\n    name = \"md5\"\n    digest_size = 16\n    block_size = 64\n", "path": "cryptography/primitives/hashes.py"}]}