Privacy-preserving Hamming distance Protocol and Its Applications