@xtsai/xai-utils
Version:
The xai-utils is an openai nodejs sdk compatible extension library.
15 lines • 362 B
JavaScript
import { createHash } from 'crypto';
/**
*
* @param content
* @param opts
* @returns hash string
*/
export function calcHash(content = '', opts = {
encoding: 'utf8',
alg: 'sha256',
}) {
const { encoding = 'utf8', alg = 'sha256' } = opts;
return createHash(alg).update(content, encoding).digest('hex');
}
//# sourceMappingURL=file.hash.js.map