Cosmetics

This commit is contained in:
Kagami Hiiragi 2014-12-28 14:04:28 +03:00
parent fb178bf19b
commit b6a8840bc7
1 changed files with 3 additions and 1 deletions

View File

@ -41,11 +41,13 @@ With the help of browserify `eccrypto` provides different implementations for Br
```js ```js
var crypto = require("crypto"); var crypto = require("crypto");
var eccrypto = require("eccrypto"); var eccrypto = require("eccrypto");
var privateKey = crypto.randomBytes(32); var privateKey = crypto.randomBytes(32);
var publicKey = eccrypto.getPublic(privateKey); var publicKey = eccrypto.getPublic(privateKey);
var str = "test msg"; var str = "msg to sign";
// Always hash you msg to sign! // Always hash you msg to sign!
var msg = crypto.createHash("sha256").update(str).digest(); var msg = crypto.createHash("sha256").update(str).digest();
eccrypto.sign(privateKey, msg).then(function(sig) { eccrypto.sign(privateKey, msg).then(function(sig) {
console.log("signed:", sig); console.log("signed:", sig);
// Public key is sufficient for verifying but private key also could be // Public key is sufficient for verifying but private key also could be