Comments (5)
I've fixed mcl.js to check type(9c61b5a)
from mcl-wasm.
Thank you for your report.
TypeError: invalid_argument sometime occurs while initializing this library.
I could not reproduce the bug. How do you call mcl.init()?
hashAndMapToG1 is not called in mcl.init().
from mcl-wasm.
Ah, that's true. The error occurred while calling hashAndMapToG1.
I did some unusual things to use this library from jest. Here is the essence of the code:
const mcl = require('../mcl')
const fs = require('fs')
describe('mcl-wasm module', () => {
beforeAll(() => {
global.fetch = async req => {
const buf = fs.readFileSync(req)
return {
ok: true,
arrayBuffer: async () => Uint8Array.from(buf).buffer,
}
}
})
test('initialize and hashAndMapToG1', async () => {
await mcl.init()
mcl.hashAndMapToG1(1)
})
})
And, I got the output:
TypeError: invalid_argument
at Int8Array.set (native)
at /Users/junpei/src/github.com/jkawamoto/mcl-wasm/mcl.js:128:21
at exports.G1._setter (/Users/junpei/src/github.com/jkawamoto/mcl-wasm/mcl.js:216:19)
at exports.G1.setHashOf (/Users/junpei/src/github.com/jkawamoto/mcl-wasm/mcl.js:326:14)
at Object.exports.hashAndMapToG1.s [as hashAndMapToG1] (/Users/junpei/src/github.com/jkawamoto/mcl-wasm/mcl.js:538:9)
at Object.test (/Users/junpei/src/github.com/jkawamoto/mcl-wasm/__test__/test.js:18:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
from mcl-wasm.
mcl.hashAndMapToG1(1)
hashAndMapToG1() accepts only string or Uint8Array.
Please use hashAndMapToG1("1")
or hashAndMapToG1(new Uint8Array([1]))
.
These values are not same.
I will write document of mcl later.
from mcl-wasm.
Thanks! Converting the number to a string works for me.
I'll close this issue.
from mcl-wasm.
Related Issues (20)
- mulVec is not exposed HOT 5
- Beautify mcl_c.js and mcl_c512.js to reduce error size HOT 4
- Checking if a value is on curve? HOT 5
- Expose mclBnFp_mapToG1 and mclBnFp2_mapToG2 HOT 1
- Pairing: check if G1/G2 not in expected subgroup HOT 4
- Can't resolve 'perf_hooks' HOT 12
- Typescript types HOT 5
- index.d.ts isn't published with npm module HOT 4
- Expose G1.mapTo and G2.mapTo
- `ReferenceError: window is not defined` upon import HOT 16
- getStr() incorrect result HOT 1
- run `mcl-wasm` inside SES HOT 38
- Multiply point with scalar value HOT 3
- How to set the vaule of G? HOT 8
- BLS Fr setHashOf HOT 4
- err _wrapInput when trying to invoke setStr HOT 3
- Possible to mod order? HOT 3
- Use with webpack? HOT 8
- Intermittent issue with GT.setStr() HOT 3
- Cannot import scalar values from BLS12-381 Ethereum test suite HOT 6
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 mcl-wasm.