14 lines
352 B
TypeScript
14 lines
352 B
TypeScript
import crypto from 'node:crypto'
|
|
import { type 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
|
|
}
|