diff --git a/index.js b/index.js index cbc58b3..75f9072 100644 --- a/index.js +++ b/index.js @@ -1682,11 +1682,11 @@ function crypto_sign_open(msg, sm, pk) { function crypto_sign_verify_detached (sig, m, pk) { check(sig, crypto_sign_BYTES) - var sm = new Uint8Array(m.length + sig.length) + var sm = new Uint8Array(m.length + crypto_sign_BYTES) var i = 0 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) + return crypto_sign_open(m, sm, pk) } function crypto_secretbox_detached (o, mac, msg, n, k) { diff --git a/package.json b/package.json index 41d14bb..89430e5 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "devDependencies": { "browser-run": "^4.0.2", "browserify": "^14.1.0", - "sodium-test": "^0.6.0" + "sodium-test": "^0.7.0" }, "scripts": { "browser": "browserify test.js | browser-run",