def _validate_auth(self, auth_dict, password, method, uri): final_dict = {} final_dict.update(auth_dict) final_dict["password"] = password final_dict["method"] = method final_dict["uri"] = uri HA1_str = "%(username)s:%(realm)s:%(password)s" % final_dict HA1 = md5_digest(HA1_str) HA2_str = "%(method)s:%(uri)s" % final_dict HA2 = md5_digest(HA2_str) final_dict["HA1"] = HA1 final_dict["HA2"] = HA2 response_str = "%(HA1)s:%(nonce)s:%(nc)s:" \ "%(cnonce)s:%(qop)s:%(HA2)s" % final_dict response = md5_digest(response_str) return response == auth_dict["response"]
def _validate_auth(self, auth_dict, password, method, uri): final_dict = {} final_dict.update(auth_dict) final_dict["password"] = password final_dict["method"] = method final_dict["uri"] = uri HA1_str = "%(username)s:%(realm)s:%(password)s" % final_dict HA1 = md5_digest(HA1_str) HA2_str = "%(method)s:%(uri)s" % final_dict HA2 = md5_digest(HA2_str) final_dict["HA1"] = HA1 final_dict["HA2"] = HA2 response_str = "%(HA1)s:%(nonce)s:%(nc)s:" \ "%(cnonce)s:%(qop)s:%(HA2)s" % final_dict response = md5_digest(response_str) return response == auth_dict["response"]
def _generate_nonce(self): self._request_num += 1 nonce = md5_digest(str(self._request_num)) self._nonces.append(nonce) return nonce
def _generate_nonce(self): self._request_num += 1 nonce = md5_digest(str(self._request_num)) self._nonces.append(nonce) return nonce