In order to avoid privacy information leakage, a k-nearest neighbor query method of privacy protection for university libraries' self-built featured databases based on the national secret algorithm is studied. Through a parallel clustering algorithm based on grid density and locally sensitive hash functions, hash quantization processes the original dataset in the self-built featured database to obtain average bucket clustering results; Based on the average bucket label, a secure index structure for a one-way dictionary is established to generate a key for encrypting and decrypting the subset of data managed in each average bucket through the SM4 algorithm and SM2 algorithm in the hybrid national security algorithm. Using the secure index structure of a one-way dictionary and the key generated by the national secret algorithm, it can quickly search for k-nearest neighbors of privacy protection and efficiently add, delete, and modify data in the featured database built by university libraries. The experiment proves that this method can effectively encrypt and decrypt the data in the featured database built by university libraries, and achieve the k-nearest neighbor query of privacy protection for the featured database; In different data dimensions, the k-nearest neighbor query efficiency of this method is faster; For different databases, the maximum query inflation of this method is around 9.1, which is within a reasonable range, that is, the security of k-nearest neighbor queries is better.