Digest Access Authenctication in python

Question:

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="[email protected]"
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))
Asked By: Kairat Kempirbaev

||

Answers:

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

this

to this

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