Files
wireadmin/web/src/lib/utils/hash.ts
Shahrad Elahi efb93e5e31 v2 (#11)
2024-05-29 20:10:18 +03:30

12 lines
283 B
TypeScript

import { createHash } from 'crypto';
export function sha256(data: Buffer | string): string {
const hash = createHash('sha256');
hash.update(data);
return hash.digest('hex');
}
export function hex(data: Buffer | string): string {
return Buffer.from(data).toString('hex');
}