Skip to content

Instantly share code, notes, and snippets.

@vraghuvaran
Last active September 23, 2019 12:47
Show Gist options
  • Save vraghuvaran/5eb5fc3d8d77eb75aa6ae96f514407c5 to your computer and use it in GitHub Desktop.
Save vraghuvaran/5eb5fc3d8d77eb75aa6ae96f514407c5 to your computer and use it in GitHub Desktop.
This is the simple python algorithm for digest authentication if qop selected is auth
##############################################################################################
# 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').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