open-index/open-npm huggingface dataset:
npm package: @mpetrunic/amcl
Latest version: 1.0.1

Suppose you want to implement ECDH with NIST256 elliptic curve. First you need to initialize the context:

```
var ctx = new CTX("NIST256");
```
then you can call the functions as follows:
```
ctx.ECDH.KEY_PAIR_GENERATE(...);
ctx.ECDH.ECPSVDP_DH(...);
```
If you need to use more than one elliptic curve in the same script you only need to initialize two different contexts, for example
```
var ctx1 = new CTX("NIST256");
var ctx2 = new CTX("C25519");
```
The following is the list of all elliptic curves supported by MCJS
```
['ED25519', 'C25519', 'C41417', 'GOLDILOCKS', 'NIST256', 'NIST384','NIST521', 'BRAINPOOL', 'ANSSI', 'HIFIVE', 'NUMS256W', 'SECP256K1'
'NUMS256E', 'NUMS384W', 'NUMS384E', 'NUMS512W', 'NUMS512E', 'BN254', 'BN254CX', 'BLS383', 'BLS381', 'FP256BN', 'FP512BN', 'BLS461', 'BLS24', 'BLS48'];
```

This library supports also RSA encryption/decryption and RSA signature. The following is a quick example on how to use RSA. First initialize the context
```
var ctx = new CTX("RSA2048");
```
then you can call the RSA functions as follows:
```
ctx.RSA.ENCRYPT(...);
ctx.RSA.DECRYPT(...);
```
The following is the list of all the RSA security level supported by *MCJS*
```
['RSA2048','RSA3072','RSA4096'];
```

MCJS supports also SHA256, SHA384, SHA512, AES-GCM encryption and Marsaglia & Zaman random number generator. Those functions are contained in every context initialized with RSA or with an elliptic curve. If you want to create a context supporting only those general functions then initialize it with no parameter as follows:
```
var ctx = new CTX();
```

--------------------------------------


To see some running examples, load TestALL.html or TestBLS.html or TestNHS.html or BenchtestALL.html into your favourite browser.
You might have to wait a few seconds for the benchmarking scripts to complete.

For TestALL.html the correct PIN number is 1234.
npm package: @mpetrunic/bls-js
Description: Implementation of bls signature verification for ethereum 2.0
Author: ChainSafe Systems
Latest version: 0.1.3

### ChainSafe ETH2.0 Projects
Note:
There is a lot of work being done that are core infrastructural pieces for Eth2.0. Contributions to any of the below repositories would be greatly appreciated. All the libraries are written in TypeScript (or in the process of being converted from pure JS to TypeScript):
<br />
-- [PM / Meta Repo](https://github.com/ChainSafe/Sharding)<br />
|-- [Beacon Chain](https://github.com/ChainSafe/lodestar_chain)<br />
|-- [Simple Serialize (SSZ)](https://github.com/ChainSafe/ssz-js)<br />
|-- [Fixed Size Numbers](https://github.com/ChainSafe/fixed-sized-numbers-ts/)<br />
|-- [BLS Signatures and Signature Aggregation](https://github.com/ChainSafe/bls-js)<br />

# bls-js

[![Build Status](https://travis-ci.org/ChainSafe/bls-js.svg?branch=master)](https://travis-ci.org/ChainSafe/bls-js)
[![codecov](https://codecov.io/gh/ChainSafe/bls-js/branch/master/graph/badge.svg)](https://codecov.io/gh/ChainSafe/bls-js)
[![](https://badges.gitter.im/chainsafe/lodestar.svg)](https://gitter.im/chainsafe/lodestar?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
![ETH2.0_Spec_Version 0.6.0](https://img.shields.io/badge/ETH2.0_Spec_Version-0.6.0-2e86c1.svg)

This is a Javascript library that implements BLS (Boneh-Lynn-Shacham) signatures and supports signature aggregation.

>[spec](https://github.com/ethereum/eth2.0-specs/blob/master/specs/bls_signature.md)

>[test vectors](https://github.com/ethereum/eth2.0-spec-tests/tree/master/tests/bls)

## Usage
- `npm install bls-js`
- `yarn add bls-js`

## Development
- `git clone --recursive git@github.com:ChainSafe/bls-js.git`
- `yarn install`
- `yarn test`