I want to perform such a calculation The first formula: a = bc^e The second formula: m = ac^(-e)
The cyclic group I chose is group G1 on an elliptic curve of class Type A, and then e is selected from element_init_zr
In principle, the values of f and b should be equal, but the result of the code shows that they are not
Please look at this program for me and tell me exactly what went wrong, why m and b are not equal in the output of the program, and where did I go wrong
#include <iostream>
#include <pbc/pbc.h>
using namespace std;
pairing_t pairing;
element_t g, h;
// System Initialization
void sysInitial()
{
cout << "*********************************System Initialization********************************" << endl;
// Set pbc param
char param[1024];
size_t count = fread(param, 1, 1024, stdin);
if (!count)
pbc_die("input error");
// Initialize pairing
pairing_init_set_buf(pairing, param, count);
// Declare and initialize variables
element_init_G1(h, pairing);
element_init_G1(g, pairing);
// Generate the variables
element_random(g);
cout << "System initialization finished!" << endl;
}
int main () {
sysInitial();
element_t a, b, c, d, e_invert, e, f, m;
element_init_G1(a, pairing);
element_init_G1(b, pairing);
element_init_G1(c, pairing);
element_init_G1(d, pairing);
element_init_G1(f, pairing);
element_init_G1(m, pairing);
element_init_Zr(e, pairing);
element_init_Zr(e_invert, pairing);
element_random(b);
element_random(c);
element_random(e);
element_pow_zn(d, c, e);
element_mul(a, b, d);
element_printf("The b in the first phase: %B \n", b);
element_invert(e_invert, e);
element_pow_zn(f, c, e_invert);
element_mul(m, f, a);
element_printf("The m in the first phase: %B \n", m);
return 0;
}