Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [6.0.?] - 2017-12-28
### Fixed
- Bugfix for `params()` and `paramsSync()` argument ordering of `maxmem` and `maxmemfrac` to match documentation.

## [6.0.2] - 2016-04-17
### Fixed
- Microsoft compile issues
Expand Down
4 changes: 2 additions & 2 deletions src/node-boilerplate/inc/scrypt_params_async.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class ScryptParamsAsyncWorker : public ScryptAsyncWorker {
ScryptParamsAsyncWorker(Nan::NAN_METHOD_ARGS_TYPE info) :
ScryptAsyncWorker(new Nan::Callback(info[4].As<v8::Function>())),
maxtime(info[0]->NumberValue()),
maxmemfrac(info[1]->NumberValue()),
maxmem(info[2]->IntegerValue()),
maxmemfrac(info[2]->NumberValue()),
maxmem(info[1]->IntegerValue()),
osfreemem(info[3]->IntegerValue())
{
logN = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/node-boilerplate/scrypt_params_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ NAN_METHOD(paramsSync) {
// Arguments from JavaScript
//
const double maxtime = info[0]->NumberValue();
const size_t maxmem = info[2]->IntegerValue();
const double maxmemfrac = info[1]->NumberValue();
const size_t maxmem = info[1]->IntegerValue();
const double maxmemfrac = info[2]->NumberValue();
const size_t osfreemem = info[3]->IntegerValue();

//
Expand Down
12 changes: 12 additions & 0 deletions tests/scrypt-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,18 @@ describe("Scrypt Node Module Tests", function() {
});
}
});

describe("Sanity check results of paramSync calls", function() {
it("Should return p>1 for a 4MB maxmem limit and 10s maxtime", function() {
var params = scrypt.paramsSync(10, Math.pow(2, 22));
expect(params.p).to.be.above(1);
});

it("Should return p==1 for a 32MB maxmem limit and 0.001s maxtime", function() {
var params = scrypt.paramsSync(0.001, Math.pow(2, 25));
expect(params.p).to.be.equal(1);
});
});
});

describe("Scrypt KDF Function", function() {
Expand Down