Use hash.js impl of SHA-256 and RIPEMD-160

Because it's already required by elliptic
This commit is contained in:
Kagami Hiiragi 2015-01-05 16:34:52 +03:00
parent b8b6294f95
commit 2dd9efd1a6
2 changed files with 6 additions and 4 deletions

View File

@ -5,17 +5,19 @@
"use strict"; "use strict";
var createHash = require("sha.js"); var createHash = require("sha.js");
var ripemd160 = require("ripemd160"); var hash = require("hash.js");
exports.sha512 = function(buf) { exports.sha512 = function(buf) {
return createHash("sha512").update(buf).digest(); return createHash("sha512").update(buf).digest();
}; };
exports.sha256 = function(buf) { exports.sha256 = function(buf) {
return createHash("sha256").update(buf).digest(); return hash.sha256().update(buf).digest();
}; };
exports.ripemd160 = ripemd160; exports.ripemd160 = function(buf) {
return hash.ripemd160().update(buf).digest();
};
exports.randomBytes = function(size) { exports.randomBytes = function(size) {
var arr = new Uint8Array(size); var arr = new Uint8Array(size);

View File

@ -49,8 +49,8 @@
"bs58": "^2.0.0", "bs58": "^2.0.0",
"buffer-equal": "~0.0.1", "buffer-equal": "~0.0.1",
"eccrypto": "^0.1.1", "eccrypto": "^0.1.1",
"hash.js": "^0.3.2",
"object.assign": "^1.1.1", "object.assign": "^1.1.1",
"ripemd160": "^0.2.0",
"sha.js": "^2.3.0" "sha.js": "^2.3.0"
} }
} }