Merge pull request #9 from braydonf/rmd160
crypto-browserify supports ripemd160
This commit is contained in:
commit
b6a8bdc133
|
@ -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));
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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…
Reference in New Issue