💾 Archived View for iich.space › src › util › hash.ts captured on 2022-03-01 at 16:00:10.
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
import { Encoding, createHash } from 'crypto'; export const generateHash = ( input: string, encoding: Encoding = 'utf8', ): string => { const hash = createHash('sha256'); hash.update(process.env.SALT!); hash.update(input, encoding); return hash .digest() .toString('base64') .slice(0) .replaceAll('+', '-') .replaceAll('/', '_'); };