Gathering detailed insights and metrics for eccrypto-js
Gathering detailed insights and metrics for eccrypto-js
Gathering detailed insights and metrics for eccrypto-js
Gathering detailed insights and metrics for eccrypto-js
@toruslabs/eccrypto
JavaScript Elliptic curve cryptography library, includes fix to browser.js so that encrypt/decrypt works
eccrypto
JavaScript Elliptic curve cryptography library
@types/eccrypto
TypeScript definitions for eccrypto
ecies-geth
JavaScript Elliptic Curve Integrated Encryption Scheme (ECIES) Library - Based off Geth's implementation
npm install eccrypto-js
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
28 Stars
235 Commits
11 Forks
5 Watching
16 Branches
1 Contributors
Updated on 20 Jun 2024
TypeScript (99.59%)
JavaScript (0.41%)
Cumulative downloads
Total Downloads
Last day
465%
695
Compared to previous day
Last week
216.3%
4,223
Compared to previous week
Last month
124.2%
8,442
Compared to previous month
Last year
-45.4%
53,331
Compared to previous year
Elliptic curve cryptography library (NodeJS, Browser and Pure JS)
This library is a port from eccrypto it makes use of native libraries on NodeJS and Browser enviroments with pure javascript fallbacks.
1import * as eccryptoJS from 'eccrypto-js'; 2 3const length = 32; 4const key = eccryptoJS.randomBytes(length); 5 6// key.length === length
1import * as eccryptoJS from 'eccrypto-js'; 2 3const key = eccryptoJS.randomBytes(32); 4const iv = eccryptoJS.randomBytes(16); 5 6const str = 'test message to encrypt'; 7const msg = eccryptoJS.utf8ToBuffer(str); 8 9const ciphertext = await eccryptoJS.aesCbcEncrypt(iv, key, msg); 10 11const decrypted = await eccryptoJS.aesCbcDecrypt(iv, key, ciphertext); 12 13// decrypted.toString() === str
1import * as eccryptoJS from 'eccrypto-js'; 2 3const key = eccryptoJS.randomBytes(32); 4const iv = eccryptoJS.randomBytes(16); 5 6const macKey = eccryptoJS.concatBuffers(iv, key); 7const dataToMac = eccryptoJS.concatBuffers(iv, key, msg); 8 9const mac = await eccryptoJS.hmacSha256Sign(macKey, dataToMac); 10 11const result = await eccryptoJS.hmacSha256Verify(macKey, dataToMac, mac); 12 13// result will return true if match
1import * as eccryptoJS from 'eccrypto-js'; 2 3// SHA256 4const str = 'test message to hash'; 5const msg = eccryptoJS.utf8ToBuffer(str); 6const hash = await eccryptoJS.sha256(str); 7 8// SHA512 9const str = 'test message to hash'; 10const msg = eccryptoJS.utf8ToBuffer(str); 11const hash = await eccryptoJS.sha512(str);
1import * as eccryptoJS from 'eccrypto-js'; 2 3// SHA3 4const str = 'test message to hash'; 5const msg = eccryptoJS.utf8ToBuffer(str); 6const hash = await eccryptoJS.sha3(str); 7 8// KECCAK256 9const str = 'test message to hash'; 10const msg = eccryptoJS.utf8ToBuffer(str); 11const hash = await eccryptoJS.keccak256(str);
1import * as eccryptoJS from 'eccrypto-js'; 2 3const keyPair = eccryptoJS.generateKeyPair(); 4 5const str = 'test message to hash'; 6const msg = eccryptoJS.utf8ToBuffer(str); 7const hash = await eccryptoJS.sha256(str); 8 9const sig = await eccryptoJS.sign(keyPair.privateKey, hash); 10 11await eccryptoJS.verify(keyPair.publicKey, msg, sig); 12 13// verify will throw if signature is BAD
1import * as eccryptoJS from 'eccrypto-js'; 2 3const keyPairA = eccryptoJS.generateKeyPair(); 4const keyPairB = eccryptoJS.generateKeyPair(); 5 6const sharedKey1 = await eccryptoJS.derive( 7 keyPairA.privateKey, 8 keyPairB.publicKey 9); 10 11const sharedKey2 = await eccryptoJS.derive( 12 keyPairB.privateKey, 13 keyPairA.publicKey 14); 15 16// sharedKey1.toString('hex') === sharedKey2.toString('hex')
1import * as eccryptoJS from 'eccrypto-js'; 2 3const keyPair = eccryptoJS.generateKeyPair(); 4 5const str = 'test message to encrypt'; 6const msg = eccryptoJS.utf8ToBuffer(str); 7 8const encrypted = await eccryptoJS.encrypt(keyPairB.publicKey, msg); 9 10const decrypted = await eccryptoJS.decrypt(keyPairB.privateKey, encrypted); 11 12// decrypted.toString() === str
1import * as eccryptoJS from 'eccrypto-js'; 2 3const password = 'password'; 4const buffer = eccryptoJS.utf8ToBuffer(str); 5 6const key = await eccryptoJS.pbkdf2(buffer); 7 8// key.length === 32
This library is intended for use in a Browser or NodeJS environment, however it is possible to use in a React-Native environment if NodeJS modules are polyfilled with react-native-crypto
, read more here.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/19 approved changesets -- 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
Project has not signed or included provenance with any releases.
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
52 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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