Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Digest Access Authenctication in python

I am trying to follow the explanation from the Wikipedia

I get the desired HA1 and HA2 but i can’t figure out why my response doesn’t give the same response from the tutorial.

password =  "Circle Of Life"

username="Mufasa"
realm="testrealm@host.com"
nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093"
uri="/dir/index.html"
qop="auth"
nc="00000001"
cnonce="0a4f113b"
response="6629fae49393a05397450978507c4ef1"
opaque="5ccc069c403ebaf9f0171e9517f40e41"
import hashlib 
def getMD5(s):
    return hashlib.md5(s.encode()).hexdigest()
def get1(password):
    return (getMD5(username +":"+realm+":"+password))

hash1 =get1(password)
HA2 = getMD5("GET:"+uri)
print(hash1)
print(HA2)
print(getMD5(hash1 +":"+nonce+":"+nc+":"+cnonce+":"+qop+":"+":"+HA2))

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

(getMD5(hash1 +":"+nonce+":"+nc+":"+cnonce+":"+qop+":"+":"+HA2))

this

to this

getMD5(hash1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + HA2)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading