Browse Source

Merge pull request #9 from braydonf/rmd160

crypto-browserify supports ripemd160
patch-2
Patrick Nagurny 9 years ago
parent
commit
b6a8bdc133
  1. 11
      lib/crypto/hash.js
  2. 10
      npm-shrinkwrap.json
  3. 1
      package.json

11
lib/crypto/hash.js

@ -1,6 +1,5 @@
'use strict';
var hashjs = require('hash.js');
var sha512 = require('sha512');
var crypto = require('crypto');
var BufferUtil = require('../util/buffer');
@ -32,16 +31,6 @@ Hash.ripemd160 = function(buf) {
return crypto.createHash('ripemd160').update(buf).digest();
};
// Node.js crypto ripemd160 hashes are not supported in a browser
// We'll replace with a (slower) version that does.
if (process.browser) {
Hash.ripemd160 = function(buf) {
$.checkArgument(BufferUtil.isBuffer(buf));
var hash = (new hashjs.ripemd160()).update(buf).digest();
return new Buffer(hash);
};
}
Hash.sha256ripemd160 = function(buf) {
$.checkArgument(BufferUtil.isBuffer(buf));
return Hash.ripemd160(Hash.sha256(buf));

10
npm-shrinkwrap.json

@ -26,14 +26,14 @@
"version": "1.0.5",
"from": "brorand@^1.0.1",
"resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz"
},
"hash.js": {
"version": "1.0.3",
"from": "hash.js@=1.0.3",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz"
}
}
},
"hash.js": {
"version": "1.0.2",
"from": "hash.js@^1.0.0",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.2.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@=2.0.1",

1
package.json

@ -84,7 +84,6 @@
"bs58": "=2.0.0",
"buffer-compare": "=1.0.0",
"elliptic": "=3.0.3",
"hash.js": "=1.0.2",
"inherits": "=2.0.1",
"lodash": "=3.10.1",
"sha512": "=0.0.1"

Loading…
Cancel
Save