Files
certd/packages/core/basic/src/utils/util.hash.ts
T

13 lines
269 B
TypeScript
Raw Normal View History

2024-11-01 00:59:09 +08:00
import crypto from 'crypto';
2024-09-06 10:19:03 +08:00
function md5(data: string) {
2024-11-01 00:59:09 +08:00
return crypto.createHash('md5').update(data).digest('hex');
2024-09-06 10:19:03 +08:00
}
2024-12-22 14:00:46 +08:00
function sha256(data: string) {
return crypto.createHash('sha256').update(data).digest('hex');
}
2024-09-06 10:19:03 +08:00
export const hashUtils = {
md5,
2024-12-22 14:00:46 +08:00
sha256,
2024-09-06 10:19:03 +08:00
};