JHUISI / charm

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

Exponentiation Problem of G2 in MNT curve #253

Closed Aticode closed 4 years ago

Aticode commented 4 years ago

from charm.toolbox.pairinggroup import PairingGroup,ZR,G1,G2,GT,pair

group = PairingGroup("MNT224") g = group.random(G1) h = group.random(G2) a, b = group.random(ZR, 2)

G1 = (g a) b G2 = g * (a b) H1 = (h a) b H2 = h * (a b)

print('G1:', G1) print('G2:', G2) print('H1:', H1) print('H2:', H2)

I got this:

G1: [10078373295334768694563741838278622956778134163588850571046784075738, 11285206652127590502238684314907500254559622599368025831501761600958] G2: [10078373295334768694563741838278622956778134163588850571046784075738, 11285206652127590502238684314907500254559622599368025831501761600958] H1: [[3534196784717504462328757211224470588231695063171615945530129056656, 10211780109365030693121484817970351226593726986080067998578894245699, 6368599583350992357625322855407611464986270273403678555426952468683], [13684062230274089937149579621207233764284608067400053114106045228780, 9213593495915716016992145616323404591735310637893710560096176472666, 8444322233041608777047377989157187452524603129738981272127139119302]] H2: [[1419904059378831003656260139736181866360018467588549133311449391908, 8009525015121730906488018517095803865211202805317619827555115979123, 13352161910105351377726749012042030874411151465492265223612708819089], [13998900821711144185326068030921609854586336394019796349518302780691, 4263873462088002148509836008014306558952369669692605762808882317126, 714307621193276272340511827939733717827940292614445171003103716515]]

So why H1 is not equal to H2?