Fix error for lack of rmd160 in Electron v4
This commit is contained in:
parent
d4dc26fb33
commit
335ed99a1c
2 changed files with 19 additions and 6 deletions
|
@ -2,9 +2,16 @@
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const createHash = require('create-hash');
|
const createHash = require('create-hash');
|
||||||
function ripemd160(buffer) {
|
function ripemd160(buffer) {
|
||||||
return createHash('rmd160')
|
try {
|
||||||
.update(buffer)
|
return createHash('rmd160')
|
||||||
.digest();
|
.update(buffer)
|
||||||
|
.digest();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
return createHash('ripemd160')
|
||||||
|
.update(buffer)
|
||||||
|
.digest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.ripemd160 = ripemd160;
|
exports.ripemd160 = ripemd160;
|
||||||
function sha1(buffer) {
|
function sha1(buffer) {
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
const createHash = require('create-hash');
|
const createHash = require('create-hash');
|
||||||
|
|
||||||
export function ripemd160(buffer: Buffer): Buffer {
|
export function ripemd160(buffer: Buffer): Buffer {
|
||||||
return createHash('rmd160')
|
try {
|
||||||
.update(buffer)
|
return createHash('rmd160')
|
||||||
.digest();
|
.update(buffer)
|
||||||
|
.digest();
|
||||||
|
} catch (err) {
|
||||||
|
return createHash('ripemd160')
|
||||||
|
.update(buffer)
|
||||||
|
.digest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sha1(buffer: Buffer): Buffer {
|
export function sha1(buffer: Buffer): Buffer {
|
||||||
|
|
Loading…
Reference in a new issue