Gathering detailed insights and metrics for eccrypto
Gathering detailed insights and metrics for eccrypto
Gathering detailed insights and metrics for eccrypto
Gathering detailed insights and metrics for eccrypto
@types/eccrypto
TypeScript definitions for eccrypto
@toruslabs/eccrypto
JavaScript Elliptic curve cryptography library, includes fix to browser.js so that encrypt/decrypt works
eccrypto-js
Elliptic curve cryptography library (NodeJS, Browser and Pure JS)
@browser-network/crypto
A wrapper around eccrypto designed for use in the browser-network ecosystem
npm install eccrypto
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
301 Stars
107 Commits
99 Forks
15 Watching
5 Branches
7 Contributors
Updated on 26 Nov 2024
JavaScript (83.47%)
C++ (12.21%)
Python (4.32%)
Cumulative downloads
Total Downloads
Last day
12%
10,775
Compared to previous day
Last week
9.3%
63,888
Compared to previous week
Last month
18.1%
242,024
Compared to previous month
Last year
28.2%
2,026,483
Compared to previous year
5
12
1
JavaScript Elliptic curve cryptography library for both browserify and node.
There is currently not any isomorphic ECC library which provides ECDSA, ECDH and ECIES for both Node.js and Browser and uses the fastest implementation available (e.g. secp256k1-node is much faster than other libraries but can be used only on Node.js). So eccrypto
is an attempt to create one.
With the help of browserify eccrypto
provides different implementations for Browser and Node.js with the same API. Because WebCryptoAPI defines asynchronous promise-driven API, the implementation for Node needs to use promises too.
ECDH only works in Node 0.11+ (see https://github.com/joyent/node/pull/5854), ECDSA only supports keys in PEM format (see https://github.com/joyent/node/issues/6904) and ECIES is not supported at all.
ECDSA and ECDH are supported in Chrome only on Windows (see also bug 338883), aren't supported by Firefox (fixed only in 36.0+, see bug 1034854; see also feature matrix) and ECIES is not defined at all in WebCryptoAPI draft. Also WebCryptoAPI currently defines only curves recommended by NIST meaning that secp256k1 (K-256) curve is not supported (see also: [1], [2]).
So we use seck256k1 library in Node for ECDSA, elliptic in Browser for ECDSA and ECDH and implement ECIES manually with the help of native crypto API.
1var crypto = require("crypto"); 2var eccrypto = require("eccrypto"); 3 4// A new random 32-byte private key. 5var privateKey = eccrypto.generatePrivate(); 6// Corresponding uncompressed (65-byte) public key. 7var publicKey = eccrypto.getPublic(privateKey); 8 9var str = "message to sign"; 10// Always hash you message to sign! 11var msg = crypto.createHash("sha256").update(str).digest(); 12 13eccrypto.sign(privateKey, msg).then(function(sig) { 14 console.log("Signature in DER format:", sig); 15 eccrypto.verify(publicKey, msg, sig).then(function() { 16 console.log("Signature is OK"); 17 }).catch(function() { 18 console.log("Signature is BAD"); 19 }); 20});
1var eccrypto = require("eccrypto"); 2 3var privateKeyA = eccrypto.generatePrivate(); 4var publicKeyA = eccrypto.getPublic(privateKeyA); 5var privateKeyB = eccrypto.generatePrivate(); 6var publicKeyB = eccrypto.getPublic(privateKeyB); 7 8eccrypto.derive(privateKeyA, publicKeyB).then(function(sharedKey1) { 9 eccrypto.derive(privateKeyB, publicKeyA).then(function(sharedKey2) { 10 console.log("Both shared keys are equal:", sharedKey1, sharedKey2); 11 }); 12});
1var eccrypto = require("eccrypto"); 2 3var privateKeyA = eccrypto.generatePrivate(); 4var publicKeyA = eccrypto.getPublic(privateKeyA); 5var privateKeyB = eccrypto.generatePrivate(); 6var publicKeyB = eccrypto.getPublic(privateKeyB); 7 8// Encrypting the message for B. 9eccrypto.encrypt(publicKeyB, Buffer.from("msg to b")).then(function(encrypted) { 10 // B decrypting the message. 11 eccrypto.decrypt(privateKeyB, encrypted).then(function(plaintext) { 12 console.log("Message to part B:", plaintext.toString()); 13 }); 14}); 15 16// Encrypting the message for A. 17eccrypto.encrypt(publicKeyA, Buffer.from("msg to a")).then(function(encrypted) { 18 // A decrypting the message. 19 eccrypto.decrypt(privateKeyA, encrypted).then(function(plaintext) { 20 console.log("Message to part A:", plaintext.toString()); 21 }); 22});
eccrypto - JavaScript Elliptic curve cryptography library
Written in 2014-2015 by Kagami Hiiragi kagami@genshiken.org
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/18 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
49 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More