Debian Codegraph @

node/uuid/dist-node/sha1.js

raw
1 import { createHash } from 'node:crypto';
2 function sha1(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('sha1').update(bytes).digest();
10 }
11 export default sha1;