You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
537 B
22 lines
537 B
7 years ago
|
const createHash = require('create-hash')
|
||
11 years ago
|
|
||
6 years ago
|
export function ripemd160 (buffer: Buffer): Buffer {
|
||
10 years ago
|
return createHash('rmd160').update(buffer).digest()
|
||
11 years ago
|
}
|
||
|
|
||
6 years ago
|
export function sha1 (buffer: Buffer): Buffer {
|
||
10 years ago
|
return createHash('sha1').update(buffer).digest()
|
||
11 years ago
|
}
|
||
|
|
||
6 years ago
|
export function sha256 (buffer: Buffer): Buffer {
|
||
10 years ago
|
return createHash('sha256').update(buffer).digest()
|
||
11 years ago
|
}
|
||
|
|
||
6 years ago
|
export function hash160 (buffer: Buffer): Buffer {
|
||
8 years ago
|
return ripemd160(sha256(buffer))
|
||
|
}
|
||
|
|
||
6 years ago
|
export function hash256 (buffer: Buffer): Buffer {
|
||
8 years ago
|
return sha256(sha256(buffer))
|
||
|
}
|