SIP Realm 认证 Response 值的计算方法

本文介绍了SIP协议中realm认证的Response值计算方法。通过使用Python的MD5哈希函数,展示了如何根据用户名、realm、密码、nonce、请求方法及URI等参数计算出最终的认证Response值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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) 得到结果

转载于:https://my.oschina.net/kingchen8080/blog/529846

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值