| 1 |
import { createHash } from 'node:crypto'; |
| 2 |
function md5(bytes) { |
| 3 |
if (Array.isArray(bytes)) { |
| 4 |
bytes = Buffer.from(bytes); |
| 5 |
} |
| 6 |
else if (typeof bytes === 'string') { |
| 7 |
bytes = Buffer.from(bytes, 'utf8'); |
| 8 |
} |
| 9 |
return createHash('md5').update(bytes).digest(); |
| 10 |
} |
| 11 |
export default md5; |