Philipp Horstenkamp c3b63b7fea
Some checks failed
Try out action / pre-commit Autoupdate (push) Failing after 33s
Lint / pre-commit Autoupdate (push) Failing after 41s
Trying a first version.
2024-05-28 22:09:02 +02:00

13 lines
284 B
JavaScript

import crypto from 'crypto';
function sha1(bytes) {
if (Array.isArray(bytes)) {
bytes = Buffer.from(bytes);
} else if (typeof bytes === 'string') {
bytes = Buffer.from(bytes, 'utf8');
}
return crypto.createHash('sha1').update(bytes).digest();
}
export default sha1;