Skip to content

Instantly share code, notes, and snippets.

@vraghuvaran
Last active December 6, 2019 01:04
Show Gist options
  • Save vraghuvaran/d13751443d76377a84be104e5250d6ca to your computer and use it in GitHub Desktop.
Save vraghuvaran/d13751443d76377a84be104e5250d6ca to your computer and use it in GitHub Desktop.
This is the simple python algorithm for digest authentication mentioned in RFC 2617 if qop field option selected is auth-int
##############################################################################################
# realm=value generated by the server when identified by the client browser it displays #
# authentication for user #
# noncecount=count of the nonce generated by the client #
# clientnonce=nonce generated by the client #
# qop=denotes the option selected by the client out of list of qop options generated by the #
# server #
# nonce=random string generated by the server #
##############################################################################################
import hashlib
hash1=hashlib.md5('username:realm:password').hexdigest()
hash2=hashlib.md5('method:uri:md5(entitybody)').hexdigest()
response=hashlib.md5('hash1:nonce:noncecount:clientnonce:qop:hash2').hexdigest()
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment