Fix error for lack of rmd160 in Electron v4

This commit is contained in:
junderw 2019-04-02 18:57:07 +09:00
parent d4dc26fb33
commit 335ed99a1c
No known key found for this signature in database
GPG key ID: B256185D3A971908
2 changed files with 19 additions and 6 deletions

View file

@ -2,10 +2,17 @@
Object.defineProperty(exports, "__esModule", { value: true });
const createHash = require('create-hash');
function ripemd160(buffer) {
try {
return createHash('rmd160')
.update(buffer)
.digest();
}
catch (err) {
return createHash('ripemd160')
.update(buffer)
.digest();
}
}
exports.ripemd160 = ripemd160;
function sha1(buffer) {
return createHash('sha1')

View file

@ -1,9 +1,15 @@
const createHash = require('create-hash');
export function ripemd160(buffer: Buffer): Buffer {
try {
return createHash('rmd160')
.update(buffer)
.digest();
} catch (err) {
return createHash('ripemd160')
.update(buffer)
.digest();
}
}
export function sha1(buffer: Buffer): Buffer {