From 2f20972b5974a638d4d50981d53db43400f4ab02 Mon Sep 17 00:00:00 2001 From: Luke Burns Date: Wed, 12 Jul 2017 16:42:24 -0400 Subject: [PATCH] fixed detached sign/verify --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 1b7d52b..28497da 100644 --- a/index.js +++ b/index.js @@ -1601,7 +1601,7 @@ function crypto_sign(sm, m, sk) { function crypto_sign_detached(sig, m, sk) { var sm = new Uint8Array(m.length + crypto_sign_BYTES) crypto_sign(sm, m, sk) - for (var i = 0; i < 32; i++) sig[i] = sm[i] + for (var i = 0; i < crypto_sign_BYTES; i++) sig[i] = sm[i] } function unpackneg(r, p) { @@ -1684,8 +1684,8 @@ function crypto_sign_verify_detached (sig, m, pk) { check(sig, crypto_sign_BYTES) var sm = new Uint8Array(m.length + sig.length) var i = 0 - for (i = 0; i < 64; i++) sm[i] = m[i] - for (i = 0; i < m.length; i++) sm[i + 64] = m[i] + for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i] + for (i = 0; i < m.length; i++) sm[i + crypto_sign_BYTES] = m[i] return crypto_sign_open(sm, m, pk) }