Closed
Description
I explored the library and finally came up with the following code for generating a random element on the elliptic curve.
secp256k1_ecmult_gen_context context;
void * prealloc = checked_malloc(&default_error_callback, SECP256K1_ECMULT_GEN_CONTEXT_PREALLOCATED_SIZE);
secp256k1_ecmult_gen_context_init(&context);
secp256k1_ecmult_gen_context_build(&context, &prealloc);
unsigned char exp[32];
secp256k1_scalar exponent;
secp256k1_gej generator;
int overflow;
secp256k1_rand256(exp);
secp256k1_scalar_set_b32(&exponent, exp, &overflow);
secp256k1_ecmult_gen(&context, &generator, &exponent);
The function secp256k1_ecmult_gen
raises the context->initial
group element to given exponent.
- Is there an inbuilt function to raise a given group element to a given exponent?
- I see 2 files
ecmult_impl.h
andecmult_gen_impl.h
. What's the difference? - If my point is in
secp256k1_ge
group, should I first convert it intosecp256k1_gej
group usingsecp256k1_gej_set_ge()
function and then apply the above function? Or is there a more efficient way?
Metadata
Metadata
Assignees
Labels
No labels