Sha256: 7de88abd31451a9d3efddfcd32863f2416c5aaab4ebcd755ed8280b2308ba018

Contents?: true

Size: 579 Bytes

Versions: 71

Compression:

Stored size: 579 Bytes

Contents

'use strict';

var crypto = require('crypto');

function sha1(bytes) {
  if (typeof Buffer.from === 'function') {
    // Modern Buffer API
    if (Array.isArray(bytes)) {
      bytes = Buffer.from(bytes);
    } else if (typeof bytes === 'string') {
      bytes = Buffer.from(bytes, 'utf8');
    }
  } else {
    // Pre-v4 Buffer API
    if (Array.isArray(bytes)) {
      bytes = new Buffer(bytes);
    } else if (typeof bytes === 'string') {
      bytes = new Buffer(bytes, 'utf8');
    }
  }

  return crypto.createHash('sha1').update(bytes).digest();
}

module.exports = sha1;

Version data entries

71 entries across 62 versions & 16 rubygems

Version Path
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/uuid/lib/sha1.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/uuid/lib/sha1.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/uuid/lib/sha1.js
tang-0.2.0 spec/tang_app/node_modules/uuid/lib/sha1.js
tang-0.1.0 spec/tang_app/node_modules/uuid/lib/sha1.js
tang-0.0.9 spec/tang_app/node_modules/uuid/lib/sha1.js
enju_library-0.3.8 spec/dummy/node_modules/uuid/lib/sha1.js
ilog-0.4.1 node_modules/uuid/lib/sha1.js
ilog-0.4.0 node_modules/uuid/lib/sha1.js
ilog-0.3.3 node_modules/uuid/lib/sha1.js
learn_create-0.0.22 lib/templates/javascript_lab_template/node_modules/uuid/lib/sha1.js
jester-data-8.0.0 node_modules/uuid/lib/sha1.js
ezii-os-5.2.1 node_modules/uuid/lib/sha1.js
ezii-os-2.0.1 node_modules/uuid/lib/sha1.js
ezii-os-1.1.0 node_modules/uuid/lib/sha1.js
ezii-os-1.0.0 node_modules/uuid/lib/sha1.js
ezii-os-0.0.0.1.0 node_modules/uuid/lib/sha1.js
ezii-os-0.0.0.0.1 node_modules/uuid/lib/sha1.js
blsk-sevcore-0.0.2 blsk_old/bluesky-doc/bluesky-doc/node_modules/uuid/lib/sha1.js
optimacms-0.4.3 spec/dummy/node_modules/uuid/lib/sha1.js