【发布时间】:2021-12-04 10:52:21
【问题描述】:
在 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 是两个配对元素,我想计算它们之间的异或运算。
有人可以在这方面指导我吗?这个问题有什么解决办法?
【问题讨论】:
-
Line 79,它返回一个元组,如果你知道python你可以处理x-or,但是不能保证结果会是一个点。
标签: python cryptography xor elliptic-curve charm-crypto