(Sorry if this isn't in the right SE / is not relevant for security.stackexchange - seemed like the best choice)
Is there a way for two anonymous parties to establish that they are not previously known to each other, before revealing their identities?
Suppose that Alice and Bob are able to communicate anonymously and wish to engage in some sort of embarrassing activity together at a later date. They do not mind revealing their identity if the other party is someone they do not know, but they do not want to reveal their desire to participate in this activity to someone they do know. They want a way to confirm that neither of them knows the other without having to reveal their identity in the process (but they will inevitably reveal their identity if they go ahead with whatever activity they're planning).
So far my only idea is to involve a trusted third party that receives a list of names from both parties (including their own names), and checks for matches. The third party only confirms the presence or absence of a match. It might be possible for each party to only submit a list of hashes instead of identifiable names to reduce the risk of the third party revealing identities, if certain naming and hashing standards could be agreed by Alice and Bob.
This way if there is a match, Alice and Bob only know that the other is someone from their list. This is not ideal, though, as either party could manipulate the process by providing limited or targeted names to enable them to guess the other's identity.
Are there any more elegant approaches to this situation?