ecies-lite
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "ecies-lite", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A lightweight ECIES tool implemented in pure Node.JS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,6 +19,6 @@ # ecies-lite | ||
let encEcdh = crypto.createECDH('secp256k1'); | ||
encEcdh.generateKeys(); | ||
let publicKey = encEcdh.getPublicKey(); | ||
let body = ecies.encrypt(publicKey, Buffer.from('This is a very simple test for ecies-lite')); | ||
let ecdh = crypto.createECDH('secp256k1'); | ||
ecdh.generateKeys(); | ||
let publicKey = ecdh.getPublicKey(); | ||
let body = ecies.encrypt(publicKey, Buffer.from('This message is for demo purpose')); | ||
for (let k of Object.keys(body)) { | ||
@@ -28,5 +28,3 @@ console.log(`${k}(${body[k].length}B):`, body[k].toString('base64')); | ||
let decEcdh = crypto.createECDH('secp256k1'); | ||
let plain = ecies.decrypt(encEcdh.getPrivateKey(), body); | ||
let plain = ecies.decrypt(ecdh.getPrivateKey(), body); | ||
console.log('Decrypted plain text:', plain.toString('utf-8')); | ||
@@ -38,2 +36,3 @@ ``` | ||
ecies-lite - A lightweight ECIES tool implemented in pure Node.JS | ||
Written in 2018 by tibetty <xihua.duan@gmail.com> |
6188
36