static void john_register_one(struct fmt_main *format) { if (options.format) if (strcmp(options.format, format->params.label)) return; fmt_register(format); }
static void john_register_one(struct fmt_main *format) { if (options.format) { char *pos = strchr(options.format, '*'); if (pos != strrchr(options.format, '*')) { if (john_main_process) fprintf(stderr, "Only one wildcard allowed in format " "name\n"); error(); } if (pos) { // Wildcard, as in office* if (strncasecmp(format->params.label, options.format, (int)(pos - options.format))) return; // Trailer wildcard, as in *office or raw*ng if (pos[1]) { int wild_len = strlen(++pos); int label_len = strlen(format->params.label); const char *p; if (wild_len > label_len) return; p = &format->params.label[label_len - wild_len]; if (strcasecmp(p, pos)) return; } } else if (!strcasecmp(options.format, "dynamic")) { if ( (format->params.flags & FMT_DYNAMIC) == 0) return; } else if (!strcasecmp(options.format, "cpu")) { if (strstr(format->params.label, "-opencl") || strstr(format->params.label, "-cuda")) return; } else if (!strcasecmp(options.format, "cpu-dynamic")) { if (strstr(format->params.label, "-opencl") || strstr(format->params.label, "-cuda")) return; if ( (format->params.flags & FMT_DYNAMIC) == FMT_DYNAMIC) return; } else if (!strcasecmp(options.format, "gpu")) { if (!strstr(format->params.label, "-opencl") && !strstr(format->params.label, "-cuda")) return; } else if (!strcasecmp(options.format, "opencl")) { if (!strstr(format->params.label, "-opencl")) return; } else if (!strcasecmp(options.format, "cuda")) { if (!strstr(format->params.label, "-cuda")) return; } #ifdef _OPENMP else if (!strcasecmp(options.format, "omp")) { if ((format->params.flags & FMT_OMP) != FMT_OMP) return; } else if (!strcasecmp(options.format, "cpu+omp")) { if ((format->params.flags & FMT_OMP) != FMT_OMP) return; if (strstr(format->params.label, "-opencl") || strstr(format->params.label, "-cuda")) return; } else if (!strcasecmp(options.format, "cpu+omp-dynamic")) { if ((format->params.flags & FMT_OMP) != FMT_OMP) return; if (strstr(format->params.label, "-opencl") || strstr(format->params.label, "-cuda")) return; if ( (format->params.flags & FMT_DYNAMIC) == FMT_DYNAMIC) return; } #endif else if (strcasecmp(options.format, format->params.label)) return; } fmt_register(format); }