Comments (7)
This is actually related to miracl/core#44 and in fact, the git revision refers to that repo. The issue can be reproduced against both libraries
from amcl.
from amcl.
Thanks @mcarrickscott. We were testing various ECC math/crypto libraries (e.g. miracl/core, https://github.com/ConsenSys/gnark-crypto etc) trying to develop tests asserting basic behaviour across all of them, which is how we stumbled upon this issue.
What are the restrictions on the BIG and its constructors? We were expecting that something like
func TestMaxInt(t *testing.T) {
i := FP256BN.NewBIGint(1)
for j := 0; j < 64; j++ {
i = i.Plus(i)
}
zero := FP256BN.NewBIGint(0)
assert.NotEqual(t, zero, i)
}
would work.
Let us know how we're misusing the library - thanks!
from amcl.
from amcl.
Thanks a lot! So, without the explicit call to normalization the correctness of the result of Plus
invocations is not guaranteed?
from amcl.
from amcl.
It is probably best if we implement the norm() inside of Plus() since
Plus() is public and likely to be used as you have used it. So thanks for
bringing this to my attention.
Thank you
But note that this is not a bignum library, and is not expected to be used
as one.
Fair enough; but.. computations over the exponents (e.g. g^{\sum{a_i} mod Q}) are commonplace, and one might chain multiple +'s before calling Mod(q) (which iiuc calls norm()). So for example
func TestMaxInt(t *testing.T) {
i := FP256BN.NewBIGint(1)
q := FP256BN.NewBIGints(FP256BN.CURVE_Order)
for j := 0; j < 64; j++ {
i = i.Plus(i)
}
i.Mod(q)
zero := FP256BN.NewBIGint(0)
assert.NotEqual(t, zero, i)
}
one might assume this would work (I did notice that calling mod after every Plus seems to produce the right result).
from amcl.
Related Issues (20)
- API inconsistency in ECP.mul HOT 2
- Potential bug in is_infinity in ecp.rs
- Point compression for ECP2 HOT 1
- Question about SECP256K1 curve in go HOT 2
- Pairing function does not fulfil point addition property for infinity HOT 2
- Pairing function does not return 1 for P=infinity, Q=infinity HOT 5
- Methods add, sub missing in FP12, FP24, FP48 HOT 1
- invmodp in big goes in infinite loop when inverting 0 HOT 6
- Please check the code for FP12.pow(BIG) HOT 23
- Add new curve
- bls.js and bls256.js don't load in IE 11 HOT 1
- Two small change suggestions HOT 1
- Swift issues HOT 5
- Swift compile for iOS
- A bug might exit in amcl-go
- Error compiling on armhf platform HOT 4
- Use JS version of amcl in nodejs environments HOT 2
- Does the library support type-1 curvers? HOT 2
- Help!Urgent! HOT 3
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 amcl.