标签:
sip 协议中 realm 认证中 Response 值的计算方法:
from hashlib import md5 username = ‘10000′ realm = ‘Yate’ password = ‘10000′ nonce = ‘39a45e7afdc6ec69d156ed1de42cfc5b’ method = ‘REGISTER’ uri = ’sip:127.0.0.1′ print md5(‘%(hash1)s:%(nonce)s:%(hash2)s’ % {‘hash1′:md5(‘%(username)s:%(realm)s:%(password)s’ % {‘username’:username, ‘realm’:realm, ‘password’:password}).hexdigest(), ‘nonce’:nonce, ‘hash2′: md5(‘%(method)s:%(uri)s’ % {‘method’:method, ‘uri’:uri}).hexdigest()}).hexdigest() 算法: 计算 MD5(username:realm:password) 为 HASH1 计算 MD5(method:uri) 为 HASH2 计算 MD5(HA1:nonce:HA2) 得到结果
标签:
原文地址:http://my.oschina.net/kingchen8080/blog/529846