Decentralized Peer-to-Peer (P2P) networks offer not only opportunities but also threats. Due to the autonomy, self-interest and heterogeneousness of peers, the interaction outcomes are uncertain. One way to minimize the threats in such an open environment is exploiting the reputation method to evaluate the trustworthiness and predict the future behaviors of peers. While most of the existing reputation-based trust models focus on preventing network from the malicious peers, peers' capabilities to fulfill the tasks are mostly ignored. In this paper, we present a novel trust model MHFTrust which quantifies and compares the trustworthiness of peers based on hierarchical fuzzy system. Six capability factors are identified to describe the peers' trust on the capability, and one security factor, named "Malicious behavior" is used to evaluate the peers' trust on security. Our trust model consisted of local-trust computation based on fuzzy techniques and global reputation aggregation, which integrates feedback from other peers to produce a global reputation for each peer. Credibility and weight of feedback are introduced to facilitate the computation of global reputation. It is shown in simulation that our trust model greatly improves the efficiency of P2P system, while the number of inauthentic files on the network is significantly decreased.