Adding point and an integer? Is this valid? #11

issue genjix openend this issue on May 8, 2014
  1. genjix commented at 1:13 am on May 8, 2014: none

    https://github.com/bitcoin/secp256k1/blob/master/include/secp256k1.h#L113

    int secp256k1_ecdsa_pubkey_tweak_add(unsigned char *pubkey, int pubkeylen, const unsigned char *tweak);

    Looking at the source code for this function, it seems like tweak is a 32 byte number. Is this valid?

    What is the way to add 2 points together then if this function doesn’t work.

  2. gmaxwell commented at 1:16 am on May 8, 2014: contributor
    This function is the sister of the privkey_tweak_add, it adds G*tweak in order to perform the the same operation as privkey_tweak_add and then converting it into a pubkey.
  3. genjix commented at 1:26 am on May 8, 2014: none

    Ah ok, thanks. So what is the recommended way to add 2 points?

    I see:

    Create point: void static secp256k1_gej_set_xy(secp256k1_gej_t *r, const secp256k1_fe_t *x, const secp256k1_fe_t *y);

    Add both points: void static secp256k1_gej_add(secp256k1_gej_t *r, const secp256k1_gej_t *a, const secp256k1_gej_t *b);

    And then finally convert the jacobian point back into a cartesian value (0x04, x, y) as used in Bitcoin.

    (using x/z^2 and y/z^3 as it says in group.h)

  4. genjix commented at 4:42 pm on May 8, 2014: none
    moving to new thread.
  5. genjix closed this on May 8, 2014


genjix gmaxwell


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-30 07:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me