开发者

How to convert 32digit long info hash to 40 digit long info hash in python? [closed]

It's difficult to开发者_如何学Go tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

Some websites such as Sumotorrent.com use the magnet link with the 32 digit long hash, but my code is designed to store and work with 40 digit long hash?


The info hash in those magnet links appear to be encoded in Base32, while the info hash used in bittorrent is in hexadecimal (i.e. Base16). This appears to give consistent results:

import base64
base64.b16encode(base64.b32decode("<your hash goes here>"))


Luckily 32 is smaller than 40, so you can just pad with 8 zeroes without losing information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜