代码如下:
from charm.toolbox.pairinggroup import PairingGroup, ZR, G1, G2, GT, pair
groupObj = PairingGroup('MNT224')
gt = groupObj.random(GT)
g2 = groupObj.random(GT)
result = gt -g2
环境: Linux ubuntu22.04, 魅力地穴 0.5, 蟒蛇3.10, libgmp5.1, openssl1.0, ide是vscode。
错误信息如下:
Traceback (most recent call last):
File "/home/x/ex/scheme.py", line 284, in <module>
main()
File "/home/x/ex/scheme.py", line 252, in main
gt - g2
SystemError: error return without exception set
PBC图书馆手册:GT群目前被实现为有限域的子群,因此GT只能使用乘法运算。(来自:https://crypto.stanford.edu/pbc/manual/ch04s04.html )
所以,Charm 也无法支持这个操作。