在任何一方都不知道盒子内容的情况下,使用密码学打乱顺序



我正在寻找一种方法,在两个相互不信任的客户之间打乱一组已知值(比如一副牌),这种方法可以由双方验证,不会获得任何优势。

到目前为止,我在想。。。

for each item in array:
  A tells B random number to use (Ra1) <~ prevent B from using pre-calculated password
  B creates secret random number, and shows hash to A <~ can prove this number is used
  B adds his own secret random number (Ra1+Rb1) <~ prevent A from using pre-calculated password
  B encrypts a random array value using the combined password (Ra1+Rb1), removing from the stack
  B gives encrypted value to A
  A re-encrypts the value <~ prevent B from recognizing his package later
  A stores at random index in new array of unknown items
A shows the full array to B <~ B can be confident that the array will not be tampered with
A does not know what is in each package, nor does B
B can now choose a package for himself, and A can then provide the password for that package, allowing B to recognize his package, and know the contents.
A can also choose a package, and request the key to unlock it form B.
After all transactions are agreed, and secrecy is no longer required, all secrets are revealed by both parties, who can both then verify the contents of the boxes

这一切对我来说似乎过于复杂——我无法想象如何让它在A、B和C中发挥作用,以至于任何一方都不需要值得信赖或可靠(以后可能不会提供密钥——干扰其他方之间的交易)。

摘要

理想情况下,我需要一种算法来在两个不可信的方之间洗牌,这样一来,只要最后至少有两个感兴趣的方相互提供他们的秘密,所有方都可以稍后对牌和牌进行验证。

这就是著名的心理扑克问题。一种解决方案涉及交换加密(即,E1(E2

来自维基文章:

  1. 爱丽丝和鲍勃在一副牌上意见一致。在实践中,这意味着他们在一组数字或其他数据上达成一致,使得该组的每个元素都代表一张卡片
  2. Alice选择一个加密密钥A,并使用它来加密卡片组中的每一张卡片
  3. 爱丽丝洗牌
  4. 爱丽丝把经过加密和洗牌的牌组递给鲍勃。加密到位后,Bob无法知道哪张卡是哪张
  5. Bob选择一个加密密钥B,并使用它来加密加密和洗牌牌组中的每一张卡
  6. 鲍勃拖着甲板
  7. 鲍勃把经过双重加密和洗牌的牌组传给爱丽丝
  8. 爱丽丝用她的密钥A解密每张卡。不过,这仍然保留了鲍勃的加密,所以她不知道哪张卡是哪张
  9. Alice为每张卡(A1、A2等)选择一个加密密钥,并对其进行单独加密
  10. 爱丽丝把甲板递给鲍勃
  11. 鲍勃用他的密钥B解密每张卡。不过,这仍然保留了爱丽丝的个人加密,所以他不知道哪张卡是哪张
  12. Bob为每张卡(B1、B2等)选择一个加密密钥,并对其进行单独加密
  13. 鲍勃把甲板传给爱丽丝
  14. 爱丽丝为每个玩游戏的人发布牌组
    […]
    该算法可以针对任意数量的玩家进行扩展

这允许洗牌,不允许任何一方作弊,也不需要任何一方知道对方有什么牌(如果你取消了最后一个要求,只想公平洗牌,问题就会变得容易得多)

所使用的加密必须是安全的,以防已知的明文攻击。

最新更新