
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
@vinarmani/eccrypto-js
Advanced tools
Elliptic curve cryptography library (NodeJS, Browser and Pure JS)
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.
import * as eccryptoJS from 'eccrypto-js';
const length = 32;
const key = eccryptoJS.randomBytes(length);
// key.length === length
import * as eccryptoJS from 'eccrypto-js';
const key = eccryptoJS.randomBytes(32);
const iv = eccryptoJS.randomBytes(16);
const str = 'test message to encrypt';
const msg = eccryptoJS.utf8ToBuffer(str);
const ciphertext = await eccryptoJS.aesCbcEncrypt(iv, key, msg);
const decrypted = await eccryptoJS.aesCbcDecrypt(iv, key, ciphertext);
// decrypted.toString() === str
import * as eccryptoJS from 'eccrypto-js';
const key = eccryptoJS.randomBytes(32);
const iv = eccryptoJS.randomBytes(16);
const macKey = eccryptoJS.concatBuffers(iv, key);
const dataToMac = eccryptoJS.concatBuffers(iv, key, msg);
const mac = await eccryptoJS.hmacSha256Sign(macKey, dataToMac);
const result = await eccryptoJS.hmacSha256Verify(macKey, dataToMac, mac);
// result will return true if match
import * as eccryptoJS from 'eccrypto-js';
// SHA256
const str = 'test message to hash';
const msg = eccryptoJS.utf8ToBuffer(str);
const hash = await eccryptoJS.sha256(str);
// SHA512
const str = 'test message to hash';
const msg = eccryptoJS.utf8ToBuffer(str);
const hash = await eccryptoJS.sha512(str);
import * as eccryptoJS from 'eccrypto-js';
// SHA3
const str = 'test message to hash';
const msg = eccryptoJS.utf8ToBuffer(str);
const hash = await eccryptoJS.sha3(str);
// KECCAK256
const str = 'test message to hash';
const msg = eccryptoJS.utf8ToBuffer(str);
const hash = await eccryptoJS.keccak256(str);
import * as eccryptoJS from 'eccrypto-js';
const keyPair = eccryptoJS.generateKeyPair();
const str = 'test message to hash';
const msg = eccryptoJS.utf8ToBuffer(str);
const hash = await eccryptoJS.sha256(str);
const sig = await eccryptoJS.sign(keyPair.privateKey, hash);
await eccryptoJS.verify(keyPair.publicKey, msg, sig);
// verify will throw if signature is BAD
import * as eccryptoJS from 'eccrypto-js';
const keyPairA = eccryptoJS.generateKeyPair();
const keyPairB = eccryptoJS.generateKeyPair();
const sharedKey1 = await eccryptoJS.derive(
keyPairA.privateKey,
keyPairB.publicKey
);
const sharedKey2 = await eccryptoJS.derive(
keyPairB.privateKey,
keyPairA.publicKey
);
// sharedKey1.toString('hex') === sharedKey2.toString('hex')
import * as eccryptoJS from 'eccrypto-js';
const keyPair = eccryptoJS.generateKeyPair();
const str = 'test message to encrypt';
const msg = eccryptoJS.utf8ToBuffer(str);
const encrypted = await eccryptoJS.encrypt(keyPairB.publicKey, msg);
const decrypted = await eccryptoJS.decrypt(keyPairB.privateKey, encrypted);
// decrypted.toString() === str
import * as eccryptoJS from 'eccrypto-js';
const password = 'password';
const buffer = eccryptoJS.utf8ToBuffer(str);
const key = await eccryptoJS.pbkdf2(buffer);
// 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.
FAQs
Elliptic curve cryptography library (NodeJS, Browser and Pure JS)
We found that @vinarmani/eccrypto-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.