Cloud Zhang
2024-05-16 f4c05057fb284287997775f373c33f73228a02c3
1
2
3
4
5
6
7
8
import { createHash } from 'node:crypto';
 
function createContentHash(content: string, hashLSize = 12) {
  const hash = createHash('sha256').update(content);
  return hash.digest('hex').slice(0, hashLSize);
}
 
export { createContentHash };