15 lines
350 B
TypeScript
15 lines
350 B
TypeScript
|
|
import crypto from "node:crypto";
|
||
|
|
import {IDataType, xxhash128} from "hash-wasm";
|
||
|
|
|
||
|
|
export function sha1Hash(data: crypto.BinaryLike) {
|
||
|
|
const hash = crypto.createHash('sha1');
|
||
|
|
hash.update(data);
|
||
|
|
return hash.digest('hex');
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
export async function fastHashFileV1(data: IDataType):Promise<string> {
|
||
|
|
const hash = xxhash128(data)
|
||
|
|
return hash
|
||
|
|
}
|