mirror of
https://github.com/wireadmin/wireadmin
synced 2025-06-26 18:28:06 +00:00
12 lines
283 B
TypeScript
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');
|
|
}
|