i2p domain utility

main
Bob Mottram 2020-06-11 10:25:02 +01:00
parent 585735d25b
commit 504bcef679
1 changed files with 21 additions and 0 deletions

21
i2pdomain 100755
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
__filename__ = "i2pdomain"
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
__version__ = "1.1.0"
__maintainer__ = "Bob Mottram"
__email__ = "bob@freedombone.net"
__status__ = "Production"
import base64, hashlib, sys
with open(sys.argv[1], 'rb') as f:
isRead=False
try:
print(base64.b32encode(hashlib.sha256(base64.b64decode(f.read(), '-~')).digest()).decode().strip('=').lower()+".b32.i2p")
isRead=True
except:
pass
if not isRead:
print(base64.b32encode(hashlib.sha256(base64.b64decode(f.read(516), '-~')).digest()).decode().strip('=').lower()+".b32.i2p")