{"name":"mcl-wasm","version":"1.0.2","description":"mcl ; A portable and fast pairing-based cryptography library for Node.js by WebAssembly","main":"dist/index.js","scripts":{"build":"npm run build:mcl_c.js && npm run build:dist && npm run build:browser","build:mcl_c.js":"make","build:dist":"tsc","build:browser":"webpack","lint":"standard --verbose test/test.js; ts-standard-ts --verbose src/*.ts","lint-fix":"standard --fix test/test.js; ts-standard --fix src/*.ts","test-ts":"tsc test/test-ts.ts && node test/test-ts.js","test":"tsc && node test/test.js && node test/eth-test.js"},"types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/herumi/mcl-wasm.git"},"keywords":["elliptic curve","WebAssembly","pairing"],"author":{"name":"herumi","email":"herumi@nifty.com","url":"https://github.com/herumi/"},"license":"BSD-3-Clause","bugs":{"url":"https://github.com/herumi/mcl-wasm/issues"},"engines":{"node":">=8.9.0"},"homepage":"https://github.com/herumi/mcl-wasm#readme","devDependencies":{"@types/node":"^15.14.9","assert":"^2.0.0","perf_hooks":"^0.0.1","standard":"^16.0.4","ts-loader":"^9.2.6","ts-standard":"^10.0.0","typescript":"^4.3.4","webpack":"^5.64.1","webpack-cli":"^4.9.1"},"standard":{"ignore":["src/mcl_c.js"]},"ts-standard":{"project":"./tsconfig.json"},"gitHead":"46acdf2523ca2f6fab6ae33c298aa283fc135271","_id":"mcl-wasm@1.0.2","_nodeVersion":"16.13.0","_npmVersion":"8.6.0","dist":{"integrity":"sha512-rYTsi5HRjfTUbSvaERM0t7FJm9smRFRKSqAGnlUttfDvaJxqlOaEP8rnFMWkR4mVvFQLhclnpyR8lJmE478GGg==","shasum":"2a891f2ca83c158ec453d9522957dcc6e56e28ed","tarball":"http://registry-npm.ywwl.com/mcl-wasm/download/mcl-wasm-1.0.2.tgz","fileCount":16,"unpackedSize":1225248,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC6uP/fd94/RwNOL6mP454tqx0v7QPvUQHUsYzAg3jgIAIgFocID50jxN9Z7SgT4zOreH6aLRQbXPtehvTDM8YjL9A="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiRqcTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrhhQ//arsuHwOzmJGpm8YDzkBwN1gf5ydTqRqNlC02Zs1+Hvdhlyci\r\nNVSCKfdPc3duwScY8qgQgMCZf/28o37DhtpAqZNEULRQbi9wLn243/PHGdPv\r\nDEE7DlaTGizXSyatsYigW9Ak8mQq3SqcawGrzH+GDnIsBQkpU0xVIg06uSKb\r\nsZ4SRtTt8s/DnRtQuZ+WIjni8vpBvcvtOprOqiVIYy8V7ssGFV+MKJ5s2DmD\r\nXpgeeJwxcixCjvukQD5hCBIb8QTK+ngGHuDYXBNycQ21INromp8zqB3HGCGu\r\npm7dSZ2OlxFFM6ZJb7N8/V0AW+g+lBKFhDbhUl5yO2MJr72BS0Ig1udThWw8\r\n4bz5p78s3BisMEMyx8sUkOlDy2ttX379nPwX0hye9+8ikH8Bb1+1keOriBzU\r\nOoJVLb1S6EQyAlvj8Tf8xQpgdWFDAETSeRFhd73mr3QkiTHM0mj6SYa8gTUB\r\nyVwOQqxM3XjVHU5zWfhK0DKsUN22lxp6r+dKXcOHrBwVGFb2L0FOtZLAyzYJ\r\nSgaviNjzYvtpump1JJ3g6TCxw/+j+Q1U2CTCRFpRSXvpMmPWAhrNaZeIhvrB\r\nBB/V1J5cYlSZrivc/G6nkXCSM8H9G3pAVN8/EpGoTlyLWqdFkLKGzDEncGYB\r\nwCiC7Db/x2iMN2ROcrY6oChgzQFUlODkzyU=\r\n=PGbQ\r\n-----END PGP SIGNATURE-----\r\n","size":378339,"noattachment":false,"key":"/mcl-wasm/-/mcl-wasm-1.0.2.tgz"},"_npmUser":{"name":"herumi","email":"herumi@nifty.com"},"directories":{},"maintainers":[{"name":"herumi","email":"herumi@nifty.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mcl-wasm_1.0.2_1648797459696_0.807262622035102"},"_hasShrinkwrap":false,"readme":"[![Build Status](https://github.com/herumi/mcl-wasm/actions/workflows/main.yml/badge.svg)](https://github.com/herumi/mcl-wasm/actions/workflows/main.yml)\r\n\r\n# A portable and fast pairing-based cryptography library for Node.js by WebAssembly\r\n\r\n# Abstract\r\n\r\nsee [mcl](https://github.com/herumi/mcl)\r\n\r\n## News\r\n- 2023/Sep/08 improve the performance a little\r\n- 2023/Aug/17 improve the invMod performance\r\n- 2023/Jun/10 add share/recover functions of Fr, G1, G2 for secret sharing.\r\n- 2022/May/08 fix get{X,Y,Z} and get\\_{a,b}.\r\n- 2021/Dec/15 rewritten by TypeScript (Thanks to asa-taka)\r\n- 2021/Nov/11 unify index.js of Node.js and browser (Thanks to Futa HIRAKOBA)\r\n- 2021/Aug/28 improve performance of `{G1,G2}::isValidOrder()`\r\n- 2021/Jun/22 add index.d.ts\r\n- 2021/Mar/02 improve performance\r\n- 2020/Nov/10 setup function has changed.\r\n- add `mulVec(xVec, yVec)` where xVec is an array of G1 or G2 and yVec is an array of Fr, which returns `sum of xVec[i] yVec[i]`.\r\n- G1.setHashOf is compatible with [hash-to-curve-09 BLS12381G1_XMD:SHA-256_SSWU_RO_](https://www.ietf.org/id/draft-irtf-cfrg-hash-to-curve-09.html#name-bls12381g1_xmdsha-256_sswu_)\r\n- support only BN254, ZKSNARK, BLS12-381 to remove mcl_c512.js\r\n- add mcl.precomputedMillerLoop2 and mcl.precomputedMillerLoop2mixed\r\n\r\n## How to use\r\nThe version `v0.6.0` breaks backward compatibility of the entry point.\r\n\r\n- Node.js : `const mcl = require('mcl-wasm')`\r\n- React : `const mcl = require('mcl-wasm')`\r\n- HTML : `<script src=\"https://herumi.github.io/mcl-wasm/browser/mcl.js\"></script>`\r\n\r\n## for Node.js\r\n```\r\nnode test/test.js\r\n```\r\n\r\n## browser demo\r\n[ID-based encryption](https://herumi.github.io/mcl-wasm/browser/demo.html)\r\n\r\n# usages\r\n\r\n## init\r\n\r\n```\r\n// Ethereum 2.0 spec mode\r\nmcl.init(mcl.BLS12_381)\r\n  .then(() => {\r\n    mcl.setETHserialization(true) // Ethereum serialization\r\n    mcl.setMapToMode(mcl.IRTF) // for G2.setHashOf(msg)\r\n    ...\r\n  })\r\n```\r\n\r\n## string conversion\r\n\r\n```\r\na = new mcl.Fr()\r\na.setStr('255') // set 255\r\na.setStr('0xff') // set 0xff = 255\r\na.setStr('ff', 16) // set ff as hex-string\r\n\r\na.getStr() // '255'\r\na.getStr(16) // 'ff'\r\n```\r\n\r\n## serialization\r\n\r\n```\r\n// byte array serialization\r\nb.deserialize(a.serialize()) // b.isEqualTo(a)\r\n// hex string of serialization()\r\nb.deserializeHexStr(a.serializeToHexStr())\r\n```\r\n\r\n```\r\n// serialization like Ethereum 2.0 only for BLS12-381\r\nmcl.setETHserialization(true)\r\n```\r\n\r\n## deserialization\r\n```\r\n/*\r\n  it is big cost to to verify the order\r\n  call once after init() if you want to disable it\r\n  cf. sub group problem\r\n*/\r\nmcl.verifyOrderG1(false)\r\nmcl.verifyOrderG2(false)\r\n```\r\n\r\nsee [test.js](https://github.com/herumi/mcl-wasm/blob/master/test/test.js)\r\n\r\n## Secret Sharing\r\n\r\n```typescript\r\nshareFr = (cVec: Fr[], id: Fr): Fr\r\nshareG1 = (cVec: G1[], id: Fr): G1\r\nshareG2 = (cVec: G2[], id: Fr): G2\r\n```\r\nEvaluate the value of the polynomial `f(x)` whose coefficients `cVec[]` are vec with x=id.\r\nReturn `f(id)`.\r\n\r\n```typescript\r\nrecoverFr = (idVec: Fr[], yVec: Fr[]): Fr\r\nrecoverG1 = (idVec: Fr[], yVec: G1[]): G1\r\nrecoverG2 = (idVec: Fr[], yVec: G2[]): G2\r\n```\r\nRecover the polynomial `f(x)` through the point `(idVec[0], yVec[0])`, `(idVec[1], yVec[1])`, ... and return `f(0)`.\r\nNote that the order of arguments is reversed from that of the recover function in bls-eth-wasm.\r\n\r\n# License\r\n\r\nmodified new BSD License\r\nhttp://opensource.org/licenses/BSD-3-Clause\r\n\r\n# History\r\n\r\n2019/Jan/31 add Fp.mapToG1\r\n\r\n# Author\r\n\r\nMITSUNARI Shigeo(herumi@nifty.com)\r\n\r\n# Sponsors welcome\r\n[GitHub Sponsor](https://github.com/sponsors/herumi)\r\n","publish_time":1648797459848,"_cnpm_publish_time":1648797459848,"dist-tags":{"latest":"2.6.0"}}