supranational / blst

Multilingual BLS12-381 signature library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using the C library: exp_mont_384 is hard to use

divad1196 opened this issue · comments

Hi,

Situation

I am currently trying to do (blst_p2)a ^ (size_t)b.
I found out that sometimes, the blst_p2 in the header file becomes vec384 in the source file, so i guessed that exp_mont_384 might be what I want.

I then looked for its usage and I think I should be able to write my own power function

void blst_p2_power2(blst_p2* result, blst_p2* base, size_t exp) {
    // 2 definitions of limb_t in the lib
    // typedef uint64_t limb_t;
    // typedef unsigned long long limb_t;
    static const unsigned long long p0 = (limb_t)0x89f3fffcfffcfffd;
    exp_mont_384(result, base, &exp, sizeof(exp) * 8, BLS12_381_P, p0);
}

The issue is that I cannot really import const.h for limb_t has 2 different definition in the project

typedef uint64_t limb_t;
typedef unsigned long long limb_t;

Questions

  • Am I understanding it right?
  • Is there something already available for the power function of blst_p2 types?

Sorry, I was confused by multiplicative notation. Still, having the same typedef for different types is confusing