sha1 - python多字节大数的运算问题
怪我咯
怪我咯 2017-04-17 14:43:56
0
1
837

用hashlib.sha1()计算sha1值
返回ans = h.digest()
type(ans)是'str'
len(ans)是20
ans本质上是一个160bit的大数
此时需要对不同的ans值进行xor或者取对数运算
请问有什么办法吗?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
PHPzhong

You can take out each character in ans, use ord to get its int value, and then perform operations such as xor or logarithm

ord('a') == 97
chr(97) == 'a'
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!