We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I had some issues with Python 3.3 and hashlib as it seems that hashlib is now requiring a byte stream.
Let me know if this makes sense.
Cheers.
Diff below:
diff --git a/flask_httpauth.py b/flask_httpauth.py index bdd8f95..55012a5 100644 --- a/flask_httpauth.py +++ b/flask_httpauth.py @@ -76,7 +76,7 @@ class HTTPBasicAuth(HTTPAuth): class HTTPDigestAuth(HTTPAuth): def get_nonce(self): - return md5(str(random())).hexdigest() + return md5(str(random()).encode('utf-8')).hexdigest() def authenticate_header(self): session["auth_nonce"] = self.get_nonce() @@ -89,9 +89,9 @@ class HTTPDigestAuth(HTTPAuth): if auth.nonce != session.get("auth_nonce") or auth.opaque != session.get("auth_opaque"): return False a1 = auth.username + ":" + auth.realm + ":" + password - ha1 = md5(a1).hexdigest() + ha1 = md5(a1.encode('utf-8')).hexdigest() a2 = request.method + ":" + auth.uri - ha2 = md5(a2).hexdigest() + ha2 = md5(a2.encode('utf-8')).hexdigest() a3 = ha1 + ":" + auth.nonce + ":" + ha2 - response = md5(a3).hexdigest() + response = md5(a3.encode('utf-8')).hexdigest() return response == auth.response
The text was updated successfully, but these errors were encountered:
Addressed in release 1.1.0.
Sorry, something went wrong.
miguelgrinberg
No branches or pull requests
Hi,
I had some issues with Python 3.3 and hashlib as it seems that hashlib is now requiring a byte stream.
Let me know if this makes sense.
Cheers.
Diff below:
The text was updated successfully, but these errors were encountered: