Socket
Socket
Sign inDemoInstall

mcl-wasm

Package Overview
Dependencies
0
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mcl-wasm

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


Version published
Weekly downloads
110K
decreased by-8.3%
Maintainers
1
Install size
1.13 MB
Created
Weekly downloads
 

Readme

Source

Build Status

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

Abstract

see mcl

News

  • 2020/Nov/10 setup function has changed.
  • 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].
  • G1.setHashOf is compatible with hash-to-curve-09 BLS12381G1_XMD:SHA-256_SSWU_RO_
  • support only BN254, ZKSNARK, BLS12-381 to remove mcl_c512.js
  • add mcl.precomputedMillerLoop2 and mcl.precomputedMillerLoop2mixed

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

License

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

History

2019/Jan/31 add Fp.mapToG1

Author

MITSUNARI Shigeo(herumi@nifty.com)

Sponsors welcome

GitHub Sponsor

Keywords

FAQs

Last updated on 16 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc