Skip to content

Commit

Permalink
check type of hashAndMapToGi
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Apr 24, 2018
1 parent 086b5dc commit 9c61b5a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion mcl.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@
return function () {
const args = [...arguments]
const buf = args[argNum]
const typeStr = Object.prototype.toString.apply(buf)
if (['[object String]', '[object Uint8Array]', '[object Array]'].indexOf(typeStr) < 0) {
throw new Error(`err bad type:"${typeStr}". Use String or Uint8Array.`)
}
const ioMode = args[argNum + 1] // may undefined
const pos = mod._malloc(buf.length)
if (typeof (buf) === 'string') {
if (typeStr === '[object String]') {
asciiStrToPtr(pos, buf)
} else {
mod.HEAP8.set(buf, pos)
Expand Down
Binary file modified mcl_c.wasm
Binary file not shown.
Binary file modified mcl_c512.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mcl-wasm",
"version": "0.1.7",
"version": "0.1.8",
"description": "mcl ; A portable and fast pairing-based cryptography library for Node.js by WebAssembly",
"main": "mcl.js",
"scripts": {
Expand Down

0 comments on commit 9c61b5a

Please sign in to comment.