Skip to content

Commit

Permalink
Prevent integer wrap-around with 31 rounds, fixes #24, fixes #25
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Aug 2, 2015
1 parent d5d4615 commit dd6eaf7
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bcryptjs",
"description": "Optimized bcrypt in plain JavaScript with zero dependencies.",
"version": "2.2.0",
"version": "2.2.1",
"main": "dist/bcrypt-isaac.js",
"license": "New-BSD",
"homepage": "http://dcode.io/",
Expand Down
2 changes: 1 addition & 1 deletion dist/bcrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@
} else
throw err;
}
rounds = 1 << rounds;
rounds = (1 << rounds) >>> 0;
var P = P_ORIG.slice(),
S = S_ORIG.slice(),
i = 0, j;
Expand Down
4 changes: 2 additions & 2 deletions dist/bcrypt.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/bcrypt.min.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bcryptjs",
"description": "Optimized bcrypt in plain JavaScript with zero dependencies. Compatible to 'bcrypt'.",
"version": "2.2.0",
"version": "2.2.1",
"author": "Daniel Wirtz <dcode@dcode.io>",
"contributors": [
"Shane Girish <shaneGirish@gmail.com> (https://github.com/shaneGirish)",
Expand Down
2 changes: 1 addition & 1 deletion src/bcrypt/impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ function _crypt(b, salt, rounds, callback, progressCallback) {
} else
throw err;
}
rounds = 1 << rounds;
rounds = (1 << rounds) >>> 0;
var P = P_ORIG.slice(),
S = S_ORIG.slice(),
i = 0, j;
Expand Down

0 comments on commit dd6eaf7

Please sign in to comment.