code: function digestPassword(password, salt, algorithm, encoding) {
      var hash = (salt) ? crypto.createHmac(algorithm || 'sha1', salt) : crypto.createHash(algorithm || 'sha1');
      return hash.update(password).digest(encoding || 'hex');
  }
docs: digest password string with optional salt.
  
  @param {String} password
  @param {String} [salt]
  @param {String} [algorithm='sha1']  'sha1', 'md5', 'sha256', 'sha512'...
  @param {String} [encoding='hex'] 'hex', 'binary' or 'base64'
  @return {String} digested password string