Comments (29)
- Curve SM2_P256 is not pairing-friendly, thus no bilinear pairing support. I added some minimal code below for computing a pairing over SM9 if that is what you mean.
- Any multiple of the G1 generator is also a generator (prime-order group).
include "relic.h"
int main() {
g1_t p;
g2_t q;
gt_t e;
core_init();
ep_param_set(SM9_P256);
ep_param_print();
g1_rand(p);
g1_print(p);
ep2_curve_set_twist(RLC_EP_DTYPE);
g2_rand(q);
g2_print(q);
pc_map(e, p, q);
gt_print(e);
core_clean();
return 0;
}
from relic.
How can I quickly determine if a curve is pairing-friendly?
from relic.
If you need want to learn more about pairings, read parts of Pairings for Beginners
by Costello to learn what pairing-friendly curves are, learn some SageMath, and check the parameters inside Sage.
If you just need to get the job done, pick a pairing-friendly curve from the start and stick to it. You already have two examples (BN-256 and SM9_P256).
from relic.
Sorry, I'm a beginner in using bilinear mapping. I've already set the curve with ep_param_set(SM9_P256);. Why do I still need to use ep2_curve_set_twist(RLC_EP_DTYPE);?
from relic.
To set up groups G2 and GT properly as well.
from relic.
1.Thank you, I understand a lot. Since I am dealing with curves configured over a prime field, the groups G1, G2, and GT are all of prime order. Therefore, any multiple of the G1 generator is also a generator. Is this understanding correct?
2.The multiple of the G1 generator is obtained through the function g1_mul_gen(), right? The value of the multiple should be between 1 and g1_mul_gen(), correct?
3.In addition, does relic support multi-scalar multiplication to achieve the goal of s_1 * P_1 + ... s_n * P_n?
Thank you very much for your answer.
from relic.
- Yes
- Yes, but it's a cyclic group, so there's no sense of "between".
- Look at the
g1_mul_sim
functions, org2_mul_sim
for G2.
from relic.
Sorry, I made a mistake. Here's the corrected question, thank you:
2. The multiple of the G1 generator is obtained through the function g1_mul_gen(), right? The value of the multiple should be between 1 and pc_get_ord(), correct?
from relic.
- Yes, but you will get a point instead of an integer multiple.
from relic.
I now understand that you have set up groups G1, G2, and GT, achieving G1 X G2 → GT. If I want to achieve G1 X G1 → GT, how should I modify the above code? Do I still need to use ep2_curve_set_twist(RLC_EP_DTYPE)?
from relic.
Then you need a symmetric pairing and a completely different choice of curve.
from relic.
Sorry, I don't quite understand. Could you provide a simple demo?Does the relic library support it?
from relic.
RELIC supports one inefficient example, as symmetric pairings are out-of-fashion for many years now: https://github.com/relic-toolkit/relic/blob/main/preset/gmp-pbc-ss1536.sh
from relic.
Thank you for your answer. Another question is: does the relic library currently support ECDSA and AES algorithms?
from relic.
Yes, as a very quick search would reveal.
from relic.
If I use the function pc_param_set_any(), does that mean I no longer need to use ep2_curve_set_twist(RLC_EP_DTYPE) to configure the G2 group with the default curve BN256?
from relic.
Yes.
from relic.
Hello, I have read the relic library files, g1_t q, if we want to calculate q^k, can we only use the g1_mul() function in a loop?
from relic.
Computing [k]Q (in additive notation) is just one call to g1_mul()
from relic.
Yes, you are correct, but if I want to calculate Q^ k instead of k · Q, it seems that this function is not present
from relic.
Q^k is [k]Q in multiplicative notation.
from relic.
1.So g1_mul_gen (Q, k) is Q=G ^ k instead of Q=kG?This is a bit strange.;
2.If that's the case, how can I compute kQ?
3.I only found gt_mul(C, A, B) which means C = A * B, but I couldn't find g1_mul(C, A, B) or g2_mul(C, A, B).
from relic.
Like most of the scientific literature, RELIC uses additive notation for G1 and G2, and multiplicative notation for GT. If you think this is strange, I welcome you to find another library out there with a more suitable interface.
1/2. As I told you, G^k and [k]G are the same operation, represented under different notations.
3. Because G1 and G2 are represented additively, you can use g1_add
and g2_add
to call the group operation (called point addition).
from relic.
Thank you, I understand. Please confirm the following:
- G1 and G2 use addition symbol, so adding k Qs results in Q + Q + .... + Q = Q^k = kQ. I can achieve Q = A + B = AB using g1_add.
- GT uses multiplication symbol, so multiplying k Qs results in Q * Q * .... * Q = Q^k = kQ.
- Does g1_is_valid already include the functionality of g1_on_curve?
from relic.
Confirmed 1 and 2.
- Yes, as a quick exam of the
g1_is_valid
function shows.
from relic.
Thank you for your answer, greatly appreciated.
from relic.
Sorry, I'd like to confirm again in the group represented by multiplication, Q * Q = Q ^2, it should not be equal to 2Q, right? Maybe my understanding is wrong. Because I think 2Q is scalar multiplication rather than dot multiplication.
from relic.
We're talking about groups, they only have one operation. Q^2 is the same as 2Q, only the notation is different.
from relic.
Sure, I understand a lot now, thank you very much.
from relic.
Related Issues (20)
- Want to use BN_254 curve HOT 1
- Build failure since recent commit HOT 1
- Compile failure on recent master HOT 4
- Compiling on M1 Mac HOT 1
- Compile Failue with x64-ecc-128 preset HOT 3
- cmake error the target not found HOT 2
- Homegaming HOT 1
- Leak the Secret Key of BBS Short Signature in Relic via Rowhammer HOT 4
- /demo/ers-etrs code running error HOT 3
- `bn_gcd_ext_binar` returns different Bezout coefficients HOT 2
- Problem while compiling HOT 12
- Error generating lib file HOT 2
- Alerts for errors HOT 4
- ep_curve_set_map() HOT 13
- ERROR in bn_mod_basic(); HOT 2
- Error on sha256 HOT 6
- Dose it support SGX(Software Guard Extensions )? HOT 1
- Compatibility Inquiry: Bare Metal ARM Cortex-M0+ (Raspberry Pi Pico) with RELIC Library
- Solved compiling for android with Mac m1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from relic.