]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/core-utils/crypto.ts
Fix videos language tests
[github/Chocobozzz/PeerTube.git] / shared / core-utils / crypto.ts
1 import { BinaryToTextEncoding, createHash } from 'crypto'
2
3 function sha256 (str: string | Buffer, encoding: BinaryToTextEncoding = 'hex') {
4 return createHash('sha256').update(str).digest(encoding)
5 }
6
7 function sha1 (str: string | Buffer, encoding: BinaryToTextEncoding = 'hex') {
8 return createHash('sha1').update(str).digest(encoding)
9 }
10
11 export {
12 sha256,
13 sha1
14 }