What's the exact algorithm and where is it specified in documentation?
1 Answer
The encoding of the onion service address is specified in section 6 of the rendezvous specification: https://github.com/torproject/torspec/blob/master/rend-spec-v3.txt#L2136
The onion address of a hidden service includes its identity public key, a version field and a basic checksum. All this information is then base32 encoded as shown below:
onion_address = base32(PUBKEY | CHECKSUM | VERSION) + ".onion" CHECKSUM = H(".onion checksum" | PUBKEY | VERSION)[:2]
where:
PUBKEY
is the 32 bytes ed25519 master pubkey of the hidden service.VERSION
is an one byte version field (default value\x03
)- ".onion checksum" is a constant string
CHECKSUM
is truncated to two bytes before inserting it in onion_address