Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

My example code is as follows:

 /*
 *  Example 1
 *  1) Calculate g^a
 *  2) calculate g^{-a}
 *  3) multiply g^a * g^{-a}
 *
 */

Note: here pub->p is a type A pairing.

element_t g, gA,gInverseA, a;

element_init_G1(g,pub->p);
element_init_G1(gA,pub->p);
element_init_G1(gInverseA,pub->p);

element_init_Zr(a,pub->p);

element_random(g); 
element_random(a);

element_pow_zn(gA,a);
element_invert(gInverseA,gA);

element_mul(gInverseA,gInverseA,gA); 
element_printf("\nValue %B",gInverseA);

Why does it output zero?

share|improve this question
1  
First the obvious: have you checked that element_mul is designed to allow its result to be one of its arguments? Or tried to setup a specific result variable? –  fgrieu Apr 22 at 6:50
    
Also, doesn't element_pow_zn take three parameters? –  poncho Apr 22 at 10:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.