A method for determining matching data elements of a first data set and a second data set without having to disclose the first data set and the second data set, the method comprising: generating, by a first processing device, a perfect hash function PH A from the first data set; evaluating, by the first processing device, the perfect hash function, PH A ( a i), for each element a i of the first data set; encrypting, by the first processing device, each element a i of the first data set using a public key of a homomorphic public key encryption scheme to form an encryption, E( a i); sending, by the first processing device, the public key, the perfect hash function, PH A ( a i), and the encryption, E( a i), for each element a i of the first data set to a second processing device; evaluating, by the second processing device, the perfect hash function, PH A (b j) for each element b j of the second data set; finding, by the second processing device, all i such that PH A (b j) = PH A (a i); computing, by the second processing device, Z j = r(E( a i) - E( b j)) + E( p), using the received public key and where r is a large random number and p is a predetermined variable that comprises a fixed portion k; sending, by the second processing device, Z j to the first processing device; decrypting, by the first processing device using the private key, Z j; and determining, by the first processing device, that element a i of the first data set matches element b j of the second data set if the decryption of Z j includes the fixed portion k of p and that element a i of the first data set does not match element b j of the second data set if the decryption of Z j does not include the fixed portion k of p. generating, by a first processing device, a perfect hash function PH A from the first data set; evaluating, by the first processing device, the perfect hash function, PH A ( a i), for each element a i of the first data set; encrypting, by the first processing device, each element a i of the first data set using a public key of a homomorphic public key encryption scheme to form an encryption, E( a i); sending, by the first processing device, the public key, the perfect hash function, PH A ( a i), and the encryption, E( a i), for each element a i of the first data set to a second processing device; evaluating, by the second processing device, the perfect hash function, PH A (b j) for each element b j of the second data set; finding, by the second processing device, all i such that PH A (b j) = PH A (a i); computing, by the second processing device, Z j = r(E( a i) - E( b j)) + E( p), using the received public key and where r is a large random number and p is a predetermined variable that comprises a fixed portion k; sending, by the second processing device, Z j to the first processing device; decrypting, by the first processing device using the private key, Z j; and determining, by the first processing device, that element a i of the first data set matches element b j of the second data set if the decryption of Z j includes the fixed portion k of p and that element a i of the first data set does not match element b j of the second data set if the decryption of Z j does not include the fixed portion k of p.