使用Python3计算HTTP的摘要Response值

来源:互联网 发布:知乎匿名回答在哪看 编辑:程序博客网 时间:2024/06/06 01:47


以下代码,一目了然:("******"为需要填入的参数)


import hashliburl = "********"method = "********"nonce = "*******"realm = "*******"UserName = "*******"password = "*******"nc = "*******";cnonce = "*******";qop = "*******" ;data1 = UserName + ":" + realm + ":" +passwordm1 = hashlib.md5()m1.update(data1.encode())data2 = method+":"+url;m2 = hashlib.md5()m2.update(data2.encode())data3 = m1.hexdigest() + ":"+ nonce + ":"+ nc + ":"+ cnonce +  ":"+ qop + ":"+ m2.hexdigest()m3 = hashlib.md5()m3.update(data3.encode())print(m3.hexdigest())


最后打印Response值!


参考文章:https://wenku.baidu.com/view/053319dff7ec4afe05a1df8e.html





原创粉丝点击