Skip to content

Conversation

@chrisveness
Copy link

Colin Percival has a 'sanity check' that 0 < logN < 256: see
https://github.com/Tarsnap/scrypt/blob/484dc1fb/lib/scryptenc/scryptenc.c#L206.

Since the 'N' parameter in node-scrypt is the canonical scrypt logN, it is
useful to trap the canonical 'N' being passed as early as possible, and to
report it more helpfully than 'error computing derived key'.

Following this commit, if a call is erroneously made to
scrypt.kdf('abc', { N: 65536, r: 8, p: 1 })
it will immediately have a RangeError thrown.

Colin Percival has a 'sanity check' that 0 < logN < 256: see
https://github.com/Tarsnap/scrypt/blob/484dc1fb/lib/scryptenc/scryptenc.c#L206.

Since the 'N' parameter in node-scrypt is the canonical scrypt logN, it is
useful to trap the canonical 'N' being passed as early as possible, and to
report it more helpfully than 'error computing derived key'.

Following this commit, if a call is erroneously made to
    scrypt.kdf('abc', { N: 65536, r: 8, p: 1 })
it will immediately have a RangeError thrown.
@chrisveness
Copy link
Author

Addresses #128 Error on relatively large iteration counts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant