Please note, this is a STATIC archive of website hashcat.net from October 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.

hashcat Forum

Full Version: question for
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
here (char prev) is copy semantic,but really faster than (char *prev) ?
tip:i'm learning hc, forgive my interesting...

hc->src->filehandling.c:

u64 count_lines (FILE *fd)
{
  u64 cnt = 0;

  char *buf = (char *) hcmalloc (HCBUFSIZ_LARGE + 1);

  char prev = '\n';

  while (!feof (fd))
  {
    size_t nread = fread (buf, sizeof (char), HCBUFSIZ_LARGE, fd);

    if (nread < 1) continue;

    size_t i;

    for (i = 0; i < nread; i++)
    {
      if (prev == '\n') cnt++;

      prev = buf[i];
    }
  }

  hcfree (buf);

  return cnt;
}
You could probably even come up with an algorithm that does it with SIMD, but if the overall gain is a 5ms faster hashcat startup that's not really something worth benchmarking and/or optimizing.
thank you for all.
Y'r right ,but when i draw my private code ,i would prefer to use *,xixi,GL