How actually a descriptor look like (encoding) ? is there any format
or size limit for descriptor on HSdir?
The hidden service descriptor is plain text and the full format can be found in the rend-spec document.
Where descriptors are hosted? who are HSdirs? Tor relays who donate
their disk space for hosting these messages?
Descriptors are hosted in a distributed hash table (DHT) consisting of all HSdirs, defined in the dir-spec as:
"HSDir" -- A router is a v2 hidden service directory if it stores and
serves v2 hidden service descriptors, and the authority believes that it's
been up for at least 25 hours (or the current value of
MinUptimeHidServDirectoryV2).
(as of 2013-03-11 with commit 5bab2738)
How Alice find descriptor for Bob from DHT?
Alice knows Bob's address (z.onion address, derived from Bob's public key). She then picks a random HSDir and sends it an HTTP 'GET' request for "/tor/rendezvous2/z" where z is the descriptor ID. If the request is unsuccessful, Alice retries with another randomly selected HSDir. If the request returns a 404 HTTP response, the service is not recognized. Otherwise Bob's most recent HS descriptor is returned.
All of this can also be found in the spec.
wiki says truncated SHA1 is not secure (i say full SHA1 is not
secure either) but attacker would not be able to impersonate already
existing hidden services! how he can't?
SHA1 is not completely broken, but (serious) weaknesses have been observed. Currently it's beleived that impersonating a hidden service would be very difficult, however, that's not to say that it will remain that way. As someone else mentioned, work is being done to move the hidden service spec towards using better hashing and encryption standards.
For more information see:
And finally, your main question:
let say Alice have Bob's public key (a better cipher than RSA) so
Alice don't need onion address to find Bob's public key first. is that
possible Bob just advertise his descriptor (introduction points) on
HSdirs with this custom cipher and meet Alice or hidden services are
limited to what Tor support today?
No, this is not going to be easy to do. However, if Alice already has Bob's public key once the HS connection is established you could end-to-end encrypt the channel using whatever form of encryption you want. Remember, hidden services aren't limited to HTTP, you could pipe any (TCP) protocol over the wire (and use any encryption that protocol supports) without modifying Tor's crypto at all.