Skip to content

Commit

Permalink
Merge pull request ripple-unmaintained#3 from clark800/entropy
Browse files Browse the repository at this point in the history
Fail if secure entropy source is not available
  • Loading branch information
clark800 committed Apr 15, 2015
2 parents b4af52a + 9ee2167 commit 4fe05d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lib/master_key.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ module.exports = function(options) {
entropy = new Uint32Array(new Uint8Array(entropy).buffer);
sjcl.random.addEntropy(entropy, 1024, 'crypto.randomBytes');
} else {
for (var i = 0; i < 8; i++) {
sjcl.random.addEntropy(Math.random(), 32, 'Math.random()');
}
throw new Error('No secure source of entropy available');
}

var randomBytes = sjcl.codec.bytes.fromBits(sjcl.random.randomWords(4));
var SJCL_PARANOIA_256_BITS = 6;
var words = sjcl.random.randomWords(4, SJCL_PARANOIA_256_BITS);
var randomBytes = sjcl.codec.bytes.fromBits(words);

return MasterKey.fromBytes(randomBytes);
};
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
{
"name": "ripple-wallet-generator",
"version": "1.0.2",
"version": "1.0.3",
"description": "A node.js library for generating a Ripple wallet.",
"main": "lib/wallet.js",
"scripts": {
"test": "mocha -R spec test/wallet_generator.js"
},
"repository": {
"type": "git",
"url": "https://github.com/stevenzeiler/ripple-wallet.git"
"url": "https://github.com/ripple/ripple-wallet.git"
},
"keywords": [
"ripple",
"wallet",
"crypto",
"elliptic-curve"
],
"author": "stevenzeiler",
"license": "MIT",
"license": "ISC",
"bugs": {
"url": "https://github.com/stevenzeiler/ripple-wallet/issues"
"url": "https://github.com/ripple/ripple-wallet/issues"
},
"devDependencies": {}
}

0 comments on commit 4fe05d5

Please sign in to comment.