import * as blakeHash from 'blake-hash' ; import * as createHash from 'create-hash' ; import * as createHmac from 'create-hmac' ; export function ripemd160 ( buffer ) { try { return createHash ( 'rmd160' ) . update ( buffer ) . digest ( ) ; } catch ( err ) { return createHash ( 'ripemd160' ) . update ( buffer ) . digest ( ) ; } } export function sha1 ( buffer ) { return createHash ( 'sha1' ) . update ( buffer ) . digest ( ) ; } export function sha256 ( buffer ) { return createHash ( 'sha256' ) . update ( buffer ) . digest ( ) ; } export function blake256 ( buffer ) { return blakeHash ( 'blake256' ) . update ( buffer ) . digest ( ) ; } export function hash160 ( buffer ) { return ripemd160 ( sha256 ( buffer ) ) ; } export function hash160blake256 ( buffer ) { return ripemd160 ( blake256 ( buffer ) ) ; } export function hash256 ( buffer ) { return sha256 ( sha256 ( buffer ) ) ; } export function hmacSHA512 ( key , data ) { return createHmac ( 'sha512' , key ) . update ( data ) . digest ( ) ; }