quantumcoin 7.0.7 → 7.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "..": {
20
20
  "name": "quantumcoin",
21
- "version": "7.0.7",
21
+ "version": "7.0.8",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "quantum-coin-js-sdk": "1.0.32",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quantumcoin",
3
- "version": "7.0.7",
3
+ "version": "7.0.8",
4
4
  "description": "QuantumCoin SDK - a complete SDK for dapps",
5
5
  "main": "index.js",
6
6
  "types": "src/index.d.ts",
@@ -293,7 +293,7 @@ function scrypt(password, salt, N, r, p, dkLen) {
293
293
  function scryptSync(password, salt, N, r, p, dkLen) {
294
294
  const pw = arrayify(password);
295
295
  const sa = arrayify(salt);
296
- const out = crypto.scryptSync(Buffer.from(pw), Buffer.from(sa), dkLen, { N, r, p, maxmem: 128 * 1024 * 1024 });
296
+ const out = crypto.scryptSync(Buffer.from(pw), Buffer.from(sa), dkLen, { N, r, p, maxmem: 257 * 1024 * 1024 }); //257 instead of 256 for buffer for compat for N=262144, r=8, p=1
297
297
  return bytesToHex(new Uint8Array(out));
298
298
  }
299
299
 
@@ -64,5 +64,12 @@
64
64
  const emptyDigest = qc.hashMessage("");
65
65
  assert.ok(emptyDigest.startsWith("0x") && emptyDigest.length === 66);
66
66
  });
67
+
68
+ it("scryptSync with N=262144, r=8, p=1 produces expected hardcoded output", () => {
69
+ const pw = qc.toUtf8Bytes("password");
70
+ const salt = qc.toUtf8Bytes("salt");
71
+ const out = qc.scryptSync(pw, salt, 262144, 8, 1, 32);
72
+ assert.equal(out, "0xd36e883d93698af49daa529419bb1d97da262bbaa225c12fcf05651268659f42");
73
+ });
67
74
  });
68
75
 
@@ -64,4 +64,11 @@ describe("Hashing", () => {
64
64
  const emptyDigest = qc.hashMessage("");
65
65
  assert.ok(emptyDigest.startsWith("0x") && emptyDigest.length === 66);
66
66
  });
67
+
68
+ it("scryptSync with N=262144, r=8, p=1 produces expected hardcoded output", () => {
69
+ const pw = qc.toUtf8Bytes("password");
70
+ const salt = qc.toUtf8Bytes("salt");
71
+ const out = qc.scryptSync(pw, salt, 262144, 8, 1, 32);
72
+ assert.equal(out, "0xd36e883d93698af49daa529419bb1d97da262bbaa225c12fcf05651268659f42");
73
+ });
67
74
  });