Sha256: ca97f0f060e8d35137674b1e391d2e1cf160379a187e050c1216ebf79a85dbd7

Contents?: true

Size: 397 Bytes

Versions: 7

Compression:

Stored size: 397 Bytes

Contents

var createHash = require('crypto').createHash 
var Buffer = require('buffer').Buffer
var stringify = require('json-stable-stringify')

module.exports = function hash (str, alg, format) {
  str = 'string' === typeof str ? str
    : Buffer.isBuffer(str) ? str
    : stringify(str)
  return createHash(alg || 'sha1')
    .update(str, Buffer.isBuffer(str) ? null : 'utf8').digest(format || 'hex')
}

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
minimum_viable_product-0.0.11 test/dummy/node_modules/shasum/index.js
brwy_rails-0.0.6 test/dummy/node_modules/shasum/index.js
brwy_rails-0.0.5 test/dummy/node_modules/shasum/index.js
brwy_rails-0.0.4 test/dummy/node_modules/shasum/index.js
brwy_rails-0.0.3 test/dummy/node_modules/shasum/index.js
brwy_rails-0.0.2 test/dummy/node_modules/shasum/index.js
brwy_rails-0.0.1 test/dummy/node_modules/shasum/index.js