Skip to content

Commit

Permalink
Merge 1a5a8bf into 7bfcd6f
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern committed Oct 17, 2019
2 parents 7bfcd6f + 1a5a8bf commit 7da9a71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -0,0 +1 @@
* Fixes a bug where rounds=0 was accepted for SHA1 hashes (#1617).
6 changes: 4 additions & 2 deletions src/accountImporter.js
Expand Up @@ -179,10 +179,12 @@ var _validateRequiredParameters = function(options) {
case "SHA1":
case "SHA256":
case "SHA512":
// MD5 is [0,8192] but SHA1, SHA256, and SHA512 are [1,8192]
roundsNum = parseInt(options.rounds, 10);
if (isNaN(roundsNum) || roundsNum < 0 || roundsNum > 8192) {
var minRounds = hashAlgo === "MD5" ? 0 : 1;
if (isNaN(roundsNum) || roundsNum < minRounds || roundsNum > 8192) {
return utils.reject(
"Must provide valid rounds(0..8192) for hash algorithm " + options.hashAlgo,
`Must provide valid rounds(${minRounds}..8192) for hash algorithm ${options.hashAlgo}`,
{ exit: 1 }
);
}
Expand Down

0 comments on commit 7da9a71

Please sign in to comment.