Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Rust to Javascript compile of the Parity fork of the Zcash bn pairing cryptography library, implementing an efficient bilinear pairing on the Barreto-Naehrig (BN) curve.
npm install rustbn.js
Require the module:
const bn128Module = require('rustbn.js')
Curve Addition
const ecAddPrecompile = bn128Module.cwrap('ec_add', 'string', ['string'])
var inputHexStr = '...'
let result = ecAddPrecompile(inputHexStr)
Curve Multiplication
const ecMulPrecompile = bn128Module.cwrap('ec_mul', 'string', ['string'])
var inputHexStr = '...'
let result = ecMulPrecompile(inputHexStr)
Curve Pairing
const ecPairingPrecompile = bn128Module.cwrap('ec_pairing', 'string', ['string'])
var inputHexStr = '...'
let result = ecPairingPrecompile(inputHexStr)
Compilation process is based on this tutorial using Emscripten to compile the original Rust sources to asm.js (Wikipedia). This might be extended in the future to also include a WASM
compiled version to choose from.
For basic setup follow the "Installing the Tools" section of the tutorial (make sure to use the incoming
branch of emsdk
).
For asm.js
compilation asmjs-unknown-emscripten
target has to be added with rustup
:
rustup target add asmjs-unknown-emscripten
Compilation steps can be found in the makefile
in the main directory and executed simply by
running:
make
WASM files can be compiled with make wasm
to the exp
. This is just intended for experimentation
working in browser only (not with Node.js) and not ready for production use!
Start a server with python -m SimpleHTTPServer
and browse to http://localhost:8000/. You might have
to modify the exp/index.html
file to get things to work.
Unit tests can be found in the tests
directory. Run the tests with:
npm run test
Webpack
Emscripten
and Rust
Licensed under either of
at your option.
Copyright 2016 Zcash Electric Coin Company. The Zcash Company promises to maintain the "bn" crate on crates.io under this MIT/Apache-2.0 dual license.
[0.1.0] - 2017-10-11
FAQs
Javascript bindings for https://github.com/paritytech/bn (using asm.js)
The npm package rustbn.js receives a total of 85,602 weekly downloads. As such, rustbn.js popularity was classified as popular.
We found that rustbn.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.