mimblewimble / rust-secp256k1-zkp

ZKP fork for rust-secp256k1, adds wrappers for range proofs, pedersen commitments, etc
Creative Commons Zero v1.0 Universal
56 stars 51 forks source link

minor fix: GENERATOR_H better to have exact same value as 'secp256k1-zkp' #21

Closed garyyu closed 6 years ago

garyyu commented 6 years ago

minor fix: better to have exact same value as secp256k1-zkp to avoid confusing, even 0x11 and 0x0b prefix are loaded as same Eclipse Curve point in secp256-zkp.

Refer to the original one in secp256k1-zkp:

https://github.com/mimblewimble/secp256k1-zkp/blob/testnet3/src/modules/generator/main_impl.h#L34-L41

And according to following code in secp256k1-zkp, both 0x11 & 0x01 == 1 and 0xb & 0x01 == 1 so this change doesn't make any difference. So don't worry for any side effect:)

static void secp256k1_generator_load(secp256k1_ge* ge, const secp256k1_generator* gen) {
    secp256k1_fe fe;
    secp256k1_fe_set_b32(&fe, &gen->data[1]);
    secp256k1_ge_set_xquad(ge, &fe);
    if (gen->data[0] & 1) {
        secp256k1_ge_neg(ge, ge);
    }
}