npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mcl-wasm

v1.7.0

Published

mcl ; A portable and fast pairing-based cryptography library for Node.js by WebAssembly

Downloads

489,140

Readme

Build Status

A portable and fast pairing-based cryptography library for Node.js by WebAssembly

Abstract

see mcl

News

  • 2024/Sep/18 Add batch inversion for Fr and Fp elements, and batch normalization for G1 and G2 points.
  • 2023/Sep/08 improve the performance a little
  • 2023/Aug/17 improve the invMod performance
  • 2023/Jun/10 add share/recover functions of Fr, G1, G2 for secret sharing.
  • 2022/May/08 fix get{X,Y,Z} and get_{a,b}.
  • 2021/Dec/15 rewritten by TypeScript (Thanks to asa-taka)
  • 2021/Nov/11 unify index.js of Node.js and browser (Thanks to Futa HIRAKOBA)
  • 2021/Aug/28 improve performance of {G1,G2}::isValidOrder()
  • 2021/Jun/22 add index.d.ts
  • 2021/Mar/02 improve performance
  • 2020/Nov/10 setup function has changed.

How to use

The version v0.6.0 breaks backward compatibility of the entry point.

  • Node.js : const mcl = require('mcl-wasm')
  • React : const mcl = require('mcl-wasm')
  • HTML : <script src="https://herumi.github.io/mcl-wasm/browser/mcl.js"></script>

for Node.js

node test/test.js

browser demo

ID-based encryption

usages

init

// Ethereum 2.0 spec mode
mcl.init(mcl.BLS12_381)
  .then(() => {
    mcl.setETHserialization(true) // Ethereum serialization
    mcl.setMapToMode(mcl.IRTF) // for G2.setHashOf(msg)
    ...
  })

string conversion

a = new mcl.Fr()
a.setStr('255') // set 255
a.setStr('0xff') // set 0xff = 255
a.setStr('ff', 16) // set ff as hex-string

a.getStr() // '255'
a.getStr(16) // 'ff'

serialization

// byte array serialization
b.deserialize(a.serialize()) // b.isEqualTo(a)
// hex string of serialization()
b.deserializeHexStr(a.serializeToHexStr())
// serialization like Ethereum 2.0 only for BLS12-381
mcl.setETHserialization(true)

deserialization

/*
  it is big cost to to verify the order
  call once after init() if you want to disable it
  cf. sub group problem
*/
mcl.verifyOrderG1(false)
mcl.verifyOrderG2(false)

see test.js

Secret Sharing

shareFr = (cVec: Fr[], id: Fr): Fr
shareG1 = (cVec: G1[], id: Fr): G1
shareG2 = (cVec: G2[], id: Fr): G2

Evaluate the value of the polynomial f(x) whose coefficients cVec[] are vec with x=id. Return f(id).

recoverFr = (idVec: Fr[], yVec: Fr[]): Fr
recoverG1 = (idVec: Fr[], yVec: G1[]): G1
recoverG2 = (idVec: Fr[], yVec: G2[]): G2

Recover the polynomial f(x) through the point (idVec[0], yVec[0]), (idVec[1], yVec[1]), ... and return f(0). Note that the order of arguments is reversed from that of the recover function in bls-eth-wasm.

License

modified new BSD License http://opensource.org/licenses/BSD-3-Clause

History

2019/Jan/31 add Fp.mapToG1

Author

MITSUNARI Shigeo([email protected])

Sponsors welcome

GitHub Sponsor