Skip to content

Instantly share code, notes, and snippets.

@Latezly
Last active November 1, 2022 16:21
Show Gist options
  • Select an option

  • Save Latezly/b64c1a1088d87c2ccb3c0b7136d2c1b7 to your computer and use it in GitHub Desktop.

Select an option

Save Latezly/b64c1a1088d87c2ccb3c0b7136d2c1b7 to your computer and use it in GitHub Desktop.
How to URLdecode info_hash in python
#https://stackoverflow.com/questions/5637268/how-do-you-decode-info-hash-information-from-tracker-announce-request
#https://stackoverflow.com/questions/8088375/how-do-i-convert-a-single-character-into-its-hex-ascii-value-in-python
#https://gist.github.com/dirkomatik/2274843
#https://blog.csdn.net/iodoo/article/details/49175749
#info_hash = "m%cdh%f6%18%f0k%a9O%04%60%9f%3ek%03%91%9a%9a%0b%88"
info_hash = input('Enter http hash:')#like that↑
hash = ""
i = 0
while i < len(info_hash):
if (info_hash[i] != '%'):
hash += format(ord(info_hash[i]), "x")
else:
hash += info_hash[i+1] + info_hash[i+2]
i += 2
i += 1
print("source hash is: " + hash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment