Created
February 11, 2011 09:15
-
-
Save saghul/822112 to your computer and use it in GitHub Desktop.
Calculate response hash to HTTP digest authentication challenge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from hashlib import md5 | |
| # Calculate response hash to authentication challenge | |
| def calc_auth_response(username, password, realm, nonce, digest_uri, method): | |
| ha1 = md5('%s:%s:%s' % (username, realm, password)).hexdigest() | |
| ha2 = md5('%s:%s' % (method, digest_uri)).hexdigest() | |
| response = md5('%s:%s:%s' % (ha1, nonce, ha2)).hexdigest() | |
| return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment