how to calculate .onion hostname based on the private_key file - Tor

Inside the Tor network you can use addresses in the .onion domain to access  hidden services. The address is generated based on a host's RSA key. Sometimes you may want to have multiple identities or you are running multiple hidden servers and want to check which key belongs to which hidden service, this is how to do it:

> openssl rsa -in private_key -pubout -outform DER |\
python -c 'import sys,hashlib,base64;\
print base64.b32encode(hashlib.sha1(sys.stdin.read()[22:]).digest()[:10]).lower()'

The private_key is the name of the file that holds the key used by the hidden service.


No comments:

Post a Comment