herumi / mcl

a portable and fast pairing-based cryptography library
BSD 3-Clause "New" or "Revised" License
452 stars 152 forks source link

Getting the base point in golang #38

Closed kc1212 closed 5 years ago

kc1212 commented 5 years ago

Hi, I need to generate points deterministically in order to make comparisons with alternative implementations.

What I have so far is the following:

    var f Fr
    f.SetInt64(x)

    var g1, gout G1
    // TODO set g1 to the base point
    G1Mul(&gout, &g1, &f)

but obviously gout is zero because g1 is zero.

How can I set g1 to the base point? I didn't see an API to do it.

herumi commented 5 years ago

Please use mcl::bn::hashAndMapToG1(C++) or mclBnG1_hashAndMapTo(C). cf. https://github.com/herumi/mcl#map-to-points