crypto: switch to Node.js sha512
The sha512 library has not been updated in quite some time. This switches to use Node.js crypto for sha512 that will use crypto-browserify, and more recently maintained sha.js for the browser build.
This commit is contained in:
parent
7fb064bde0
commit
514fc8d326
|
@ -1,6 +1,5 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var sha512 = require('sha512');
|
|
||||||
var crypto = require('crypto');
|
var crypto = require('crypto');
|
||||||
var BufferUtil = require('../util/buffer');
|
var BufferUtil = require('../util/buffer');
|
||||||
var $ = require('../util/preconditions');
|
var $ = require('../util/preconditions');
|
||||||
|
@ -38,8 +37,7 @@ Hash.sha256ripemd160 = function(buf) {
|
||||||
|
|
||||||
Hash.sha512 = function(buf) {
|
Hash.sha512 = function(buf) {
|
||||||
$.checkArgument(BufferUtil.isBuffer(buf));
|
$.checkArgument(BufferUtil.isBuffer(buf));
|
||||||
var hash = sha512(buf);
|
return crypto.createHash('sha512').update(buf).digest();
|
||||||
return new Buffer(hash);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Hash.sha512.blocksize = 1024;
|
Hash.sha512.blocksize = 1024;
|
||||||
|
|
|
@ -43,11 +43,6 @@
|
||||||
"version": "3.10.1",
|
"version": "3.10.1",
|
||||||
"from": "lodash@=3.10.1",
|
"from": "lodash@=3.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz"
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz"
|
||||||
},
|
|
||||||
"sha512": {
|
|
||||||
"version": "0.0.1",
|
|
||||||
"from": "sha512@=0.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/sha512/-/sha512-0.0.1.tgz"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,8 +85,7 @@
|
||||||
"buffer-compare": "=1.0.0",
|
"buffer-compare": "=1.0.0",
|
||||||
"elliptic": "=3.0.3",
|
"elliptic": "=3.0.3",
|
||||||
"inherits": "=2.0.1",
|
"inherits": "=2.0.1",
|
||||||
"lodash": "=3.10.1",
|
"lodash": "=3.10.1"
|
||||||
"sha512": "=0.0.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bitcore-build": "bitpay/bitcore-build",
|
"bitcore-build": "bitpay/bitcore-build",
|
||||||
|
|
Loading…
Reference in New Issue