Aiming at the problem of high computational overhead affecting the real-time localisation when paillier's algorithm is applied to indoor fingerprint privacy protection, this paper proposes a privacy-preserving algorithm for indoor fingerprinting positioning of mobile users to achieve trajectory anonymity and effectively improve the positioning performance. Since that the number of access points (APs) and reference points (RPs) involved in localization is the main factor affecting the time overhead of the encryption, the proposed algorithm divides the trajectory localization into continuous and discontinuous location localization. The number of APs and RPs involved in encryption is reduced by using the information of the before and after requests in continuous location localization, while the number of APs and RPs involved in encryption is reduced in discontinuous location localization. In continuous position localization, the number of APs and RPs involved in the encryption operation is reduced by using the information of before and after location requests; while in discontinuous positing localization, the coarse localization of users reduces the number of APs and RPs involved in the algorithm, thus improving the location efficiency. An optional scheme based on principal component analysis (PCA) is proposed to further improve the localization efficiency. Experimental results in a real-world environment show that the proposed algorithm can control the time required for a single positioning in both continuous and discontinuous positioning within 1 s. The positioning accuracy is improved by about 20% in continuous positioning, while the privacy protection has no effect on the positioning accuracy in discontinuous positioning. The overall performance of the localization algorithm is effectively improved.