Files
SponsorBlockServer/src/utils/getHash.ts
Dainius Daukševičius 08d27265fc migrate to typescript
2020-10-26 19:13:30 +02:00

13 lines
294 B
TypeScript

import crypto from 'crypto';
export function getHash(value: string, times = 5000) {
if (times <= 0) return "";
for (let i = 0; i < times; i++) {
let hashCreator = crypto.createHash('sha256');
value = hashCreator.update(value).digest('hex');
}
return value;
}