commit | b3f698d98ac4aee824c0e23c2e7aef451b7d5542 | [log] [tgz] |
---|---|---|

author | CryptoLime <11274077+AlessandroBudroni@users.noreply.github.com> | Wed Jun 05 13:04:49 2019 +0200 |

committer | GitHub <noreply@github.com> | Wed Jun 05 13:04:49 2019 +0200 |

tree | 2b4f1359d9a623a73f60ee807087b54061e8fee8 | |

parent | 32d0e2b7051fe06c3e01ae9a3cbb69167f6983e0 [diff] | |

parent | 7332db2bce8cd1073d8520fcb0b73e47b26be7e7 [diff] |

Merge pull request #2 from apache/update-readme update README

tree: 2b4f1359d9a623a73f60ee807087b54061e8fee8

- doc/
- examples/
- src/
- test/
- testVectors/
- .DS_Store
- .eslintignore
- .eslintrc
- .gitignore
- .travis.yml
- index.js
- LICENSE
- package.json
- README.md
- test.test
- VERSION

README.md

**category**: Library**copyright**: 2019 The Apache Software Foundation**license**: ASL 2.0 - http://www.apache.org/licenses/LICENSE-2.0**link**: https://github.com/apache/incubator-milagro-javascript**introduction**: AMCL.pdf

*MCJS - Milagro Crypto JavaScript*

MCJS is a standards compliant JavaScript cryptographic library with no external dependencies except for the random seed source.

MCJS is a refactor of the

*JavaScript*code of AMCL. For a detailed explanation about this library please read: doc/AMCL.pdf. For info about the refactoring process contact support@miracl.com.MCJS supports the standards for RSA, ECDH, ECIES, ECDSA and M-PIN, AES-GCM encryption/decryption, SHA256, SHA384, SHA512 and SHA3 hash functions and a cryptographically secure random number generator. Furthermore we recently added New Hope, a post-quantum key exchange.

MCJS is Node.js compatible and browser compatible (see some examples below).

Node.js (minimum v6.9.5) and npm are required in order to build the library and run the tests. Install also the node.js modules required with the command

npm install

Run all the tests with the following command

npm test

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

var CTX = require("milagro-crypto-js"); 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', 'SECP256K1', 'NIST256', 'NIST384', 'BRAINPOOL', 'ANSSI', 'HIFIVE', 'GOLDILOCKS', 'C41417', 'NIST521', 'NUMS256W', 'NUMS256E', 'NUMS384W', 'NUMS384E', 'NUMS512W', 'NUMS512E', 'FP256BN', 'FP512BN', 'BN254', 'BN254CX', 'BLS383', 'BLS24', 'BLS48', 'BLS381', 'BLS461'];

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 = require("milagro-crypto-js"); 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 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 = require("milagro-crypto-js"); var ctx = new CTX();

Node.js examples are provided - please see `./examples/node`

. Use the following command to run an example

node ./examples/node/example_ECC_NIST256.js

The library source code is browser compatible. The browser examples are locates in `./examples/browser`

.

The following people have contributed to milagro-crypto-c

- Mike Scott
- Kealan McCusker
- Alessandro Budroni
- Samuele Andreoli

Please add yourself here if you make or have made a contribution.