indutny / elliptic

Fast Elliptic Curve Cryptography in plain javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE] Need equivalent of secp256k1_ec_seckey_tweak_add

bitsanity opened this issue · comments

I would like to take a private key (m) and add a tweak to it, a hash of something (S):

p = m + hash(S)

I can do point addition with elliptic okay, but I am having difficulty figuring out how to do scalar addition. I see the official secp256k1 C library has this function:

int secp256k1_ec_seckey_tweak_add(
  const secp256k1_context* ctx,
  unsigned char *seckey,
  const unsigned char *tweak32
)

And the tiny-secp256k1 typescript module has this:

export function privateAdd(
  d: Uint8Array,
  tweak: Uint8Array
): Uint8Array | null

How best to do same with elliptic?