fdb92ddc06be3d8b55f14bc17892f7a3f8b3d93cca50b832bafc0ce3134a9599079a48e2e82d5f256e6bcd6730802b4358b63a7fa226c21d6df38a35d4a70e 284 B

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