Skip to content

Instantly share code, notes, and snippets.

@vraghuvaran
Created September 21, 2019 17:45
Show Gist options
  • Save vraghuvaran/13caecb0ef668730f9c05450ec68e044 to your computer and use it in GitHub Desktop.
Save vraghuvaran/13caecb0ef668730f9c05450ec68e044 to your computer and use it in GitHub Desktop.
This is the simple python algorithm to calculate the response field in the response generated by the client in Digest Authentication
##################################################################
# realm contains the value which indicates the browser to #
# display for authentication and nonce is the long random string #
# generated by the server #
##################################################################
import hashlib
hash1=hashlib.md5('username:realm:password').hexdigest()
hash2=hashlib.md5('method:URI').hexdigest()
response=hashlib.md5('hash1:nonce:hash2).hexdigest()
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment