Comments (15)
const Fp12 = bls.fields.Fp12;
const left = pairing(left1, left2, false)
const right = pairing(right1, right2, false)
Fp12.finalExponentiate(left, right)
from noble-curves.
Right...will think of something. Don't worry, there will be an api for this
from noble-curves.
You shouldn't use CURVE.G2.fromBytes
, this is internal. Use G2.fromHex
instead.
I will need to hide the internal methods to prevent misuse.
from noble-curves.
Done
from noble-curves.
Well... fuck me, I shot myself in the head with this one :D functions on the CURVE can be super useful for doing curve operations yourelf, because they have stuff like finalExponentiation on Fp12, fromBytes, etc. I implemented BBS+ and had to resort to them in a couple of places. Please leave it public, just disclaim that when using CURVE, you are on your own.
from noble-curves.
@blazmrakgid which functions? Fp, Fp2, Fp12, G1, G2 are available in top-level namespace. There is no need to write CURVE.G2 when you can just write G2.
from noble-curves.
There are some functions only on curve (Fp12.finalExponentiate for example). Looking at it, it might be the only one that I need... I got confused by fromHex
, because I would expect a hex string to go in, but it takes both hex string and bytes 🤷
I don't know all the use cases, but it might be worth creating the API with utils.pair([left1, left2], [right1, right2])
that does the e(G1, G2) = e(G1, G2)
.
Oh, I almost forgot: thanks for the library and blog, helped me a lot in understanding ECC and creating stuff with BLS 👏
from noble-curves.
bls.pairing
function has optional third argument withFinalExponent: boolean = true
.
Would it solve your use case?
See
noble-curves/src/abstract/bls.ts
Lines 236 to 245 in fe380da
from noble-curves.
Yes, that would be one solution, but I think it is slower doing it twice (once for each side)? Anyway, your work has got me really far, and not exposing the CURVE makes sense for the API. If I want performance I'll have to fork it anyways.
from noble-curves.
Yes, that would be one solution, but I think it is slower doing it twice (once for each side)?
No, the speed should be the same.
In fact many algorithms do exactly this: they execute non-final-exp part for everything and then execute final exp just once for all
from noble-curves.
Then I misunderstood how you meant me to use it. What I mean is this:
const left = pairing(left1, left2, true)
const right = pairing(right1, right2, true)
left == right
meaning final-exp runs twice. Am I missing something?
from noble-curves.
just use false
, not true.
from noble-curves.
We have gone full circle now 😄 If I use false, then i need Fp12.finalExponentiate(), which is only available on the CURVE.Fp12 😄
from noble-curves.
const left = pairing(left1, left2, false)
const right = pairing(right1, right2, false)
pairing(left, right, true)
from noble-curves.
But pairing takes G1 and G2, not Fp12, which is the result of pairing(...)?
from noble-curves.
Related Issues (20)
- Fp.fromBytes does not mod-reduce by default HOT 2
- What is the difference between getSharedSecret and ECDH_compute_key HOT 1
- Same private keys generate different signatures HOT 1
- P256 signature verification was succeed with 2 public key. HOT 3
- Secure Curves in the Javascript Web Cryptography API - secp256k1, X25519, X448, Ed25519, Ed448 HOT 6
- Wrong signature is generated HOT 8
- seeded (instead of random) ed25519 private key generation? HOT 1
- x25519 encrypt/decrypt? HOT 1
- Signature::fromHex wrong in 1.3.0 HOT 4
- Default bls12_381 is incompatible with Ethereum beacon chain HOT 8
- Incompatibility with old bls12-381 library: not in prime-order subgroup HOT 3
- H2CPoint to ProjectivePoint HOT 2
- Montgomery sample code doesn't compile. (PR submitted) HOT 1
- G2 Curve Points for `bn254.sign()` HOT 1
- Access to Fp types and finalExponentiate method HOT 1
- How do I convert a curve point into a public key? HOT 4
- Hello
- Include sha512_256 in file noble-curves.js HOT 1
- Ideas for v2 HOT 24
- BLS12_381 G1 fromHex() Instantiation Bug HOT 29
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 noble-curves.