'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = sha1;

var _crypto;

function _load_crypto() {
  return _crypto = _interopRequireDefault(require('crypto'));
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * encrypt `data` buffer or string into a sha1 hash
 * @param {string|Buffer}
 * @param {string} encoding
 * @returns {string} sha1 hash
 * @example
 * ```js
 *  sha1('foo bar') // => '3773dea65156909838fa6c22825cafe090ff8030'
 * ```
 */
function sha1(data, encoding) {
  return (_crypto || _load_crypto()).default.createHash('sha1').update(data).digest(encoding || 'hex');
}