在 Charm Crypto 中,我想计算属于 GT 组的两个配对元素的 XOR。但是,似乎不支持 XOR 操作,但组 GT 的配对元素仅支持乘法(mul)和除法(div)操作。
由于我正在尝试实现的算法,我想计算相同的 XOR。下面基本上是我的算法在简单意义上要做的事情。
>>> from charm.toolbox.pairinggroup import PairingGroup, GT
>>> group = PairingGroup('SS512')
>>> val1 = group.random(GT)
>>> val2 = group.random(GT)
>>> val = val1 ^ val2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for ^: 'pairing.Element' and 'pairing.Element'
>>>
和 是两个配对元素val1
,val2
我想计算它们之间的异或运算。
有人可以在这方面指导我吗?这个问题的解决方案是什么?