JHUISI / charm

Charm: A Framework for Rapidly Prototyping Cryptosystems
http://charm-crypto.io
GNU Lesser General Public License v3.0
541 stars 166 forks source link

error: unsupported operand type(s) for ^: 'pairing.Element' and 'pairing.Element'. How to compute XOR of two pairing elements of group GT? HELP!! #277

Closed ashishlakraa closed 2 years ago

ashishlakraa commented 2 years ago

I want to compute the XOR of two pairing elements belonging to group GT. However, it seems that XOR operation is not supported but only multiplication(mul) and division(div) operations are supported for pairing element of group GT.

I want to compute the XOR for the same because of the algorithm which I am trying to implement. Below is basically what my algorithm will do in simple sense.

>>> 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'
>>> 

The val1 and val2 are two pairing elements and I want to compute the XOR operation between them.

Can someone please guide me in this regard? What is the solution for this problem? Any help will be appreciated.