Skip to content

Commit 20fb934

Browse files
committed
Merge pull request #13 from adrianblynch/master
Add valid rounds range
2 parents 17a693f + 2f5f089 commit 20fb934

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

dist/bcrypt-isaac.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
else if (typeof rounds !== 'number')
100100
throw Error("Illegal arguments: "+(typeof rounds)+", "+(typeof seed_length));
101101
if (rounds < 4 || rounds > 31)
102-
throw Error("Illegal number of rounds: "+rounds);
102+
throw Error("Illegal number of rounds (4-31): "+rounds);
103103
var salt = [];
104104
salt.push("$2a$");
105105
if (rounds < 10)
@@ -988,7 +988,7 @@
988988

989989
// Validate
990990
if (rounds < 4 || rounds > 31) {
991-
err = Error("Illegal number of rounds: "+rounds);
991+
err = Error("Illegal number of rounds (4-31): "+rounds);
992992
if (callback) {
993993
nextTick(callback.bind(this, err));
994994
return;

dist/bcrypt.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
else if (typeof rounds !== 'number')
9696
throw Error("Illegal arguments: "+(typeof rounds)+", "+(typeof seed_length));
9797
if (rounds < 4 || rounds > 31)
98-
throw Error("Illegal number of rounds: "+rounds);
98+
throw Error("Illegal number of rounds (4-31): "+rounds);
9999
var salt = [];
100100
salt.push("$2a$");
101101
if (rounds < 10)
@@ -984,7 +984,7 @@
984984

985985
// Validate
986986
if (rounds < 4 || rounds > 31) {
987-
err = Error("Illegal number of rounds: "+rounds);
987+
err = Error("Illegal number of rounds (4-31): "+rounds);
988988
if (callback) {
989989
nextTick(callback.bind(this, err));
990990
return;

src/bcrypt.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838
(function(global) {
3939
"use strict";
40-
40+
4141
/**
4242
* bcrypt namespace.
4343
* @type {Object.<string,*>}
@@ -104,7 +104,7 @@
104104
else if (typeof rounds !== 'number')
105105
throw Error("Illegal arguments: "+(typeof rounds)+", "+(typeof seed_length));
106106
if (rounds < 4 || rounds > 31)
107-
throw Error("Illegal number of rounds: "+rounds);
107+
throw Error("Illegal number of rounds (4-31): "+rounds);
108108
var salt = [];
109109
salt.push("$2a$");
110110
if (rounds < 10)
@@ -256,11 +256,11 @@
256256
throw Error("Illegal hash length: "+hash.length+" != 60");
257257
return hash.substring(0, 29);
258258
};
259-
259+
260260
//? include("bcrypt/util.js");
261261

262262
//? include("bcrypt/impl.js");
263-
263+
264264
//? if (ISAAC) include("bcrypt/prng/isaac.js");
265265

266266
/* CommonJS */ if (typeof module !== 'undefined' && module["exports"])
@@ -269,5 +269,5 @@
269269
define(function() { return bcrypt; });
270270
/* Global */ else
271271
(global["dcodeIO"] = global["dcodeIO"] || {})["bcrypt"] = bcrypt;
272-
272+
273273
})(this);

src/bcrypt/impl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ function _crypt(b, salt, rounds, callback, progressCallback) {
391391

392392
// Validate
393393
if (rounds < 4 || rounds > 31) {
394-
err = Error("Illegal number of rounds: "+rounds);
394+
err = Error("Illegal number of rounds (4-31): "+rounds);
395395
if (callback) {
396396
nextTick(callback.bind(this, err));
397397
return;

0 commit comments

Comments
 (0)