14 lines
338 B
TypeScript
14 lines
338 B
TypeScript
'use strict';
|
|
|
|
import hash from 'hash.js';
|
|
|
|
import { arrayify, Arrayish } from './bytes';
|
|
|
|
export function sha256(data: Arrayish): string {
|
|
return '0x' + (hash.sha256().update(arrayify(data)).digest('hex'));
|
|
}
|
|
|
|
export function sha512(data: Arrayish): string {
|
|
return '0x' + (hash.sha512().update(arrayify(data)).digest('hex'));
|
|
}
|