Efficient search technology is a primary key to peer-to-peer systems. In order to address the inefficient routing problem, a DHT algorithm is presented based on the policy of clustering keys of sharing files. Under the key clustering algorithm, the ring-like key space is divided into two layers. Meanwhile, each node obtains a randomly assigned numeric value as its clustering center in key space. The lower layer, which is called AUT layer, is responsible for managing files' keys. The upper layer, HUB layer, is responsible for maintaining the clustering center of nodes. According to the AUT layer and the HUB layer separately, file keys and node clustering centers discovered from bypassing routing messages are clustered towards the clustering center of local node. The algorithm solves the problems of present unstructured algorithms in some degree, in which the datum is organized in a confused situation and routing is proceed in a disordered manner. Further, the outcome of small-world is used to cut down latency of routing hops. To improve the algorithm, a few connections to remote nodes are introduced with a suitable probability into routing table of clustering keys. In another word, the criterion of clustering is not of determination, but of probability. In this way, it is possible to route overlay network with average latency of O(log\+2N) hops.