Exemplo n.º 1
0
void AccountDetailWidget::initialize()
{
	QVBoxLayout* layout = new QVBoxLayout(this);
	layout->addLayout(createAccountName());
	layout->addLayout(createPassword());
	layout->addLayout(createSendingServer());
	layout->addLayout(createReceivingServer());
}
int main(int argc, char **argv) {
  int count, min_iter, max_iter, include_solution = 0, argno = 1;

  if (argc < 2)
    printHelp();

  if (!strcmp(argv[argno], "-soln")) {
    include_solution = 1;
    argno++;
  }

  if (argc - argno != 3)
    printHelp();

  if (!sscanf(argv[argno++], "%d", &count) || count <= 0)
    printHelp();
  if (!sscanf(argv[argno++], "%d", &min_iter) || min_iter <= 0)
    printHelp();
  if (!sscanf(argv[argno++], "%d", &max_iter) || max_iter <= 0)
    printHelp();
  if (max_iter < min_iter)
    printHelp();

  // # of examples it limited because the auto-generated username
  // only has room for 7 digits.
  if (count > 10000000) {
    printf("This only supports up to 10000000 examples.\n");
    return 1;
  }

  // randomize the random seed so you don't get the same output for
  // the same inputs
  srand(time(NULL));

  char username[USERNAME_LEN + 1], password[PASSWORD_LEN + 1],
      password_prefix[PASSWORD_LEN + 1];

  int i;
  for (i = 0; i < count; i++) {
    // randomizeString(username, USERNAME_LEN);
    sprintf(username, "u%07d", i);

    // FYI, 26^8 = 208,827,064,576
    // so 8 letters are more than enough to encode the largest possible
    // value for a signed int (2,147,483,647)

    int iter_count = min_iter + rand() % (max_iter - min_iter + 1);
    createPassword(password, password_prefix, iter_count);

    char *hash = crypt(password, "xx");

    if (include_solution) {
      printf("%s %s %s %s %d\n", username, hash, password_prefix, password,
             iter_count);
    } else {
      printf("%s %s %s\n", username, hash, password_prefix);
    }
  }

  return 0;
}