function bunch() {
  var num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  var base = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 36;

  if (typeof num !== 'number') {
    throw new TypeError('The num should be a number');
  }
  if (typeof n !== 'number' || n < 0) {
    throw new TypeError('The number of salts should be a positive integer');
  }
  if (typeof base !== 'number' || base < 16 || base > 36) {
    throw new TypeError('The base should be a number between 16 and 36');
  }

  // Create the ids
  var ids = [];
  for (var i = 0; i < num; i++) {
    ids.push(Math.floor(Math.random() * Math.pow(10, num.toString(10).length + 2)));
  }

  // Create the salts. This will be the same for all hashes
  var salts = _createSalts(n, base);

  // Combine the salts and the actual
  var hashes = ids.map(function (id) {
    return _createHash(id, salts, base);
  });

  return {
    ids: ids,
    hashes: hashes,
    salts: salts,
    base: base
  };
}
function bunch() {
  var num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  var base = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 36;

  if (typeof num !== 'number') {
    throw new TypeError('The num should be a number');
  }
  if (typeof n !== 'number' || n < 0) {
    throw new TypeError('The number of salts should be a positive integer');
  }
  if (typeof base !== 'number' || base < 16 || base > 36) {
    throw new TypeError('The base should be a number between 16 and 36');
  }

  // Create the ids
  var ids = [];
  for (var i = 0; i < num; i++) {
    ids.push(Math.floor(Math.random() * Math.pow(10, num.toString(10).length + 2)));
  }

  // Create the salts. This will be the same for all hashes
  var salts = _createSalts(n, base);

  // Combine the salts and the actual
  var hashes = ids.map(function (id) {
    return _createHash(id, salts, base);
  });

  return {
    ids: ids,
    hashes: hashes,
    salts: salts,
    base: base
  };
}
function bunch ( ) { var num = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 1 ; var n = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 2 ; var base = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : 36 ; if ( typeof num !== 'number' ) { throw new TypeError ( 'The num should be a number' ) ; } if ( typeof n !== 'number' || n < 0 ) { throw new TypeError ( 'The number of salts should be a positive integer' ) ; } if ( typeof base !== 'number' || base < 16 || base > 36 ) { throw new TypeError ( 'The base should be a number between 16 and 36' ) ; } // Create the ids var ids = [ ] ; for ( var i = 0 ; i < num ; i ++ ) { ids . push ( Math . floor ( Math . random ( ) * Math . pow ( 10 , num . toString ( 10 ) . length + 2 ) ) ) ; } // Create the salts. This will be the same for all hashes var salts = _createSalts ( n , base ) ; // Combine the salts and the actual var hashes = ids . map ( function ( id ) { return _createHash ( id , salts , base ) ; } ) ; return { ids : ids , hashes : hashes , salts : salts , base : base } ; }
Creates a specified number of random tokens
@param  {Number} num  number of tokens to create
@param  {Number} n    number of salts to add to each hash
@param  {Number} base radix base, 16 through 36 allowed
@return {Object}      a hash object containing the hashes as well as info needed to reverse them
Creates a specified number of random tokens