--- stegdetect.c.orig 2004-09-02 22:01:35.000000000 -0600 +++ stegdetect.c 2009-03-03 02:15:20.000000000 -0700 @@ -78,7 +78,7 @@ float DCThist[257]; float scale = 1; /* Sensitivity scaling */ -static int debug = 0; +static int stegdebug = 0; static int quiet = 0; static int ispositive = 0; /* Current images contain stego */ static char *transformname; /* Current transform name */ @@ -135,7 +135,7 @@ sum = count = 0; for (i = x; i < y; i++) { if ((i & ~63) == i) { - if (debug & DBG_PRINTONES) + if (stegdebug & DBG_PRINTONES) fprintf(stdout, "%d] %d\n", i, count); sum += count; count = 0; @@ -159,7 +159,7 @@ DCThist[off + 128]++; } - if (debug & DBG_PRINTHIST) { + if (stegdebug & DBG_PRINTHIST) { for (i = 0; i < 256; i++) { fprintf(stdout, "%4d: %8.1f\n", i - 128, DCThist[i]); } @@ -291,7 +291,7 @@ */ if ((fbar > f/4) && ((f - f/3) - (fbar + f/3) > 0)) { - if ((debug & DBG_CHIDIFF) && (one || two)) + if ((stegdebug & DBG_CHIDIFF) && (one || two)) fprintf(stdout, "%4d: %8.3f - %8.3f skipped (%f)\n", i*2 - 128, @@ -356,7 +356,7 @@ ymt += DCTobs[i]; ytt += DCTtheo[i]; - if (debug & DBG_CHIDIFF) { + if (stegdebug & DBG_CHIDIFF) { if (DCTobs[i] || DCTtheo[i]) fprintf(stdout, "%4d: %8.3f - %8.3f\n", i, DCTobs[i], @@ -368,7 +368,7 @@ chi = ymt - ytt; - if (debug & DBG_CHICALC) { + if (stegdebug & DBG_CHICALC) { fprintf(stdout, " (%8.3f - %8.3f)^2 = %8.3f / %8.3f = %8.3f | %8.3f\n", ymt, ytt, @@ -388,7 +388,7 @@ f = 1 - chi2cdf(sumchi, dgf - 1); - if (debug & DBG_CHIEND) { + if (stegdebug & DBG_CHIEND) { fprintf(stdout, "Categories: %d, Chi: %f, Q: %f, dis: %f -> %f\n", dgf, sumchi, f, discard, f * (1 - discard)); @@ -435,7 +435,7 @@ while (_iteration < (imaxiter)) #define BINSEARCH_NEXT(thresh) \ - if (debug & DBG_BINSRCH) \ + if (stegdebug & DBG_BINSRCH) \ fprintf(stdout, "sum: %f, percent: %f, good: %f\n", \ sum, percent, _good); \ if (_iteration == 0) { \ @@ -481,7 +481,7 @@ break; if (f > 0.4) sum += f * percent; - if ((debug & DBG_CHI) && f != 0) + if ((stegdebug & DBG_CHI) && f != 0) fprintf(stdout, "%04f[:] %8.5f%% %f\n", i, f * 100, sum); } @@ -491,7 +491,7 @@ BINSEARCH_IFABORT(end) { abort: - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "Accumulation: no detection possible\n"); return (-1); @@ -528,8 +528,8 @@ } } - if ((debug & DBG_CHI) && - ((debug & DBG_PRINTZERO) || f != 0)) + if ((stegdebug & DBG_CHI) && + ((stegdebug & DBG_PRINTZERO) || f != 0)) fprintf(stdout, "%04f: %8.5f%%\n", i, f * 100); } @@ -537,7 +537,7 @@ length = jsteg_size(data, bits, NULL); minlen = where/8; maxlen = (where + percent)/8; - if (debug & DBG_ENDVAL) { + if (stegdebug & DBG_ENDVAL) { fprintf(stdout, "Accumulation (%d): %f%% - %f (%f) (%d:%d - %d)\n", (int)percent, @@ -596,7 +596,7 @@ f = chi2test(data, bits, unify_false_outguess, off - range, off + range); sum += f; - if ((debug & DBG_CHI) && f != 0) + if ((stegdebug & DBG_CHI) && f != 0) fprintf(stdout, "%04d[:] %8.5f%%\n", i, f * 100); } @@ -618,8 +618,8 @@ sum += f; if (f > 0.001) count++; - if ((debug & DBG_CHI) && - ((debug & DBG_PRINTZERO) || f != 0)) + if ((stegdebug & DBG_CHI) && + ((stegdebug & DBG_PRINTZERO) || f != 0)) fprintf(stdout, "%04d: %8.5f%%\n", i, f * 100); } @@ -631,7 +631,7 @@ norm = sum / norm_outguess[off]; - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "Accumulation (%4.1f%%): %8.3f%% (%8.3f%%) (%4.1f)\n", percent, @@ -714,7 +714,7 @@ else if (sum >= 15 && res <= -1) negative = 1; - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) printf("Zero/One: %d : %d -> %5.1f%s\n", one, zero, (float)res/2, negative ? " **" : ""); @@ -740,7 +740,7 @@ (!DCThist[i] || !DCThist[i+1])) res++; } - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) printf("Empty pairs: %d\n", res); if (res > 3) return (1); @@ -770,7 +770,7 @@ buildDCTreset(); f = chi2test(data, bits, unify_jphide, 0, jphpos[0]); - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "Pos[0]: %04d: %8.5f%%\n", jphpos[0], f*100); /* If JPhide was used, we should get a high value at this position */ @@ -793,7 +793,7 @@ false = 0; f2 = chi2test(data, bits, unify_false_jphide, 0, jphpos[0]); - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "Pos[0]: %04d[:] %8.5f%%: %8.5f%%\n", jphpos[0], f2*100, (f2 - f)*100); @@ -802,13 +802,13 @@ return (0); f = chi2test(data, bits, unify_jphide, jphpos[0]/2, jphpos[0]); - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "Pos[0]/2: %04d: %8.5f%%\n", jphpos[0], f*100); if (f < 0.9) return (0); f2 = chi2test(data, bits, unify_false_jphide, jphpos[0]/2, jphpos[0]); - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "Pos[0]/2: %04d[:] %8.5f%%: %8.5f%%\n", jphpos[0], f2*100, (f2 - f)*100); if (f2 * 0.95 > f) @@ -816,7 +816,7 @@ f = chi2test(data, bits, unify_jphide, 0, jphpos[0]/2); f2 = chi2test(data, bits, unify_false_jphide, 0, jphpos[0]/2); - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "0->1/2: %04d[:] %8.5f%% %8.5f%%\n", jphpos[0], f*100, f2*100); @@ -864,8 +864,8 @@ else if (f < 0.2) break; - if ((debug & DBG_CHI) && - ((debug & DBG_PRINTZERO) || f != 0)) + if ((stegdebug & DBG_CHI) && + ((stegdebug & DBG_PRINTZERO) || f != 0)) fprintf(stdout, "%04d: %8.5f%% %8.5f%% %.2f %.2f %s\n", i, f * 100, f2*100, sum, false, (i <= jphpos[0] && f2*0.99 > f) || @@ -876,7 +876,7 @@ sum /= 1000; - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "Accumulation (neg = %d, %d): %f%% [%d]\n", negative, range, sum * 100, jphpos[1]); @@ -913,7 +913,7 @@ sum += f; else if (f < 0.2) break; - if ((debug & DBG_CHI) && f != 0) + if ((stegdebug & DBG_CHI) && f != 0) fprintf(stdout, "%04d[:] %8.5f%%\n", i, f * 100); } @@ -939,12 +939,12 @@ else if (f < 0.2) break; - if ((debug & DBG_CHI) && - ((debug & DBG_PRINTZERO) || f != 0)) + if ((stegdebug & DBG_CHI) && + ((stegdebug & DBG_PRINTZERO) || f != 0)) fprintf(stdout, "%04d: %8.5f%%\n", i, f * 100); } - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "Accumulation (%4.0f): %f%%\n", percent, sum * 100); @@ -1277,7 +1277,7 @@ if (jdcts != NULL) free(jdcts); scans = 0; - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "Disabled by comment check: %d\n", ncomments); @@ -1291,7 +1291,7 @@ if (jdcts != NULL) free(jdcts); scans = 0; - if (debug & DBG_ENDVAL) + if (stegdebug & DBG_ENDVAL) fprintf(stdout, "Disabled by header check: %d.%d %#0x\n", major, minor, marker); @@ -1478,7 +1478,7 @@ fprintf(stdout, "Stegdetect Version %s\n", VERSION); exit(1); case 'd': - debug = atoi(optarg); + stegdebug = atoi(optarg); break; case 't': scans = 0; @@ -1580,7 +1580,7 @@ detect(line, scans); } - if (debug & FLAG_JPHIDESTAT) { + if (stegdebug & FLAG_JPHIDESTAT) { fprintf(stdout, "Positive rejected because of\n" "\tRunlength: %d\n" "\tZero-One: %d\n"