简体   繁体   English

如何在不共享人与人之间实际字符串的情况下比较两个人的两个字符串列表?

[英]How can I compare two lists of strings from two people without sharing the actual strings between people?

For example, how can the owner of list A compare identify how many of their strings exist in List B without ever seeing List B? 例如,列表A的所有者如何比较,以识别列表B中存在多少个字符串,而没有看到列表B?

List A            List B
abcdef            abcdef
ghijkl            mnopqr
stuvwx            stuvwx
yz0123            

The result should be two. 结果应该是两个。 As in, List A has 2 strings found in List B. This is easy enough if lists are shared in open text. 与清单A一样,在清单B中有2个字符串。如果清单是在开放文本中共享的,这很容易。 But how can this answer be found without the owner of List A seeing List B? 但是,如果列表A的所有者没有看到列表B,如何找到此答案?

您可以哈希两个列表中的字符串,然后比较哈希值。

If users A and B are peers with no real "system" to handle the transactions between them, then: 如果用户A和B是没有实际“系统”来处理它们之间的事务的对等方,则:

  1. Each user enters their list into their session or client software. 每个用户将其列表输入他们的会话或客户端软件。
  2. The session or client software hashes the members of the list. 会话或客户端软件对列表的成员进行哈希处理。
  3. The session or client software then queries a database for matching hashes from user B. 然后,会话或客户端软件查询数据库以查找用户B匹配的哈希。
  4. If other users need to compare their lists with user A, the session or client software stores all hashes for user A's list in the database under records for user A. 如果其他用户需要将其列表与用户A进行比较,则会话或客户端软件会将用户A列表的所有哈希存储在数据库中用户A的记录下。

However, if there is a real system (server) between the two users, it is able to see everyone's list entries and communicate matches back to the users. 但是,如果有两个用户之间一个真正的系统(服务器),它是能够看到每个人的列表条目和交流比赛回给用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM