From 0f735fd5263ce3655e63a29a6fafbf23e53cbc69 Mon Sep 17 00:00:00 2001 From: bitsanity Date: Tue, 4 Feb 2020 10:12:54 -0800 Subject: [PATCH] fix_issue_163 --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 41da50f..0e24954 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,9 @@ const secp256k1 = require('secp256k1') // or require('secp256k1/elliptic') // if you want to use pure js implementation in node -// generate message to sign -const msg = randomBytes(32) +// msghash should be 32-byte hash of a message, e.g. sha256(msg) +// here using random data just for illustration and test +const msghash32 = randomBytes(32) // generate privKey let privKey @@ -69,10 +70,10 @@ do { const pubKey = secp256k1.publicKeyCreate(privKey) // sign the message -const sigObj = secp256k1.ecdsaSign(msg, privKey) +const sigObj = secp256k1.ecdsaSign(msghash32, privKey) // verify the signature -console.log(secp256k1.ecdsaVerify(sigObj.signature, msg, pubKey)) +console.log(secp256k1.ecdsaVerify(sigObj.signature, msghash32, pubKey)) // => true ``` -- 2.17.1