Skip to content

Commit

Permalink
Test for WCA on self instead of window for webworker compatibility, see
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Sep 23, 2015
1 parent fa5b3bc commit 89c1940
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/bcrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
return require("crypto")['randomBytes'](len);
} catch (e) {}
/* WCA */ try {
var a; (window['crypto']||window['msCrypto'])['getRandomValues'](a = new Uint32Array(len));
var a; (self['crypto']||self['msCrypto'])['getRandomValues'](a = new Uint32Array(len));
return Array.prototype.slice.call(a);
} catch (e) {}
/* fallback */ if (!randomFallback)
Expand Down
2 changes: 1 addition & 1 deletion dist/bcrypt.min.js

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

4 changes: 2 additions & 2 deletions dist/bcrypt.min.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/bcrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function random(len) {
return require("crypto")['randomBytes'](len);
} catch (e) {}
/* WCA */ try {
var a; (window['crypto']||window['msCrypto'])['getRandomValues'](a = new Uint32Array(len));
var a; (self['crypto']||self['msCrypto'])['getRandomValues'](a = new Uint32Array(len));
return Array.prototype.slice.call(a);
} catch (e) {}
/* fallback */ if (!randomFallback)
Expand Down

0 comments on commit 89c1940

Please sign in to comment.