ethers.js/src.ts/utils/sha2.ts
2018-06-22 20:30:50 -04:00

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'));
}