I need to compute a function $h^l$, where h is an element of G2 and l is a rational number. How can this be done using the PBC library?
I have converted the h
to an element in G2
As far as I have seen, for exponentiation, PBC has two functions :
element_pow_zn, and
element_pow_mpz
The first function is used when both the operands are of type element_t
. The second function will be used when the power is of type mpz_t
.
I read in the pbc manual that the mpz_t
type is for integers in GMP, while mpq_t
is for rationals. Can I use any of the functions in PBC to acquire the required exponentiation? If yes, how will I have to declare the elements?
UPDATE
Will such an initialization work :
mpz_t a, b, l;
element_t ea, eb, el, bi, t1, res;
....after computing a , b, I can use
element_set_mpz(ea, a);
.
.
element_invert(bi, b);
element_pow_zn(t1, h, a);
element_pow_zn(res, t1, bi);