1 import { BinaryToTextEncoding, createHash } from 'crypto'
3 function sha256 (str: string | Buffer, encoding: BinaryToTextEncoding = 'hex') {
4 return createHash('sha256').update(str).digest(encoding)
7 function sha1 (str: string | Buffer, encoding: BinaryToTextEncoding = 'hex') {
8 return createHash('sha1').update(str).digest(encoding)
12 function randomInt (low: number, high: number) {
13 return Math.floor(Math.random() * (high - low) + low)