Cryptography Reference
In-Depth Information
30
maxperiod = MAXPERIOD;
printf("maximal keylength: %d bytes \ n", maxperiod);
31
32
N = fread(buf, 1, MAXLEN, stdin);
/* read
file probe */
33
/* preliminary computation: bit offsets */
34
p2 = 256; blen = 9; sum = 0;
35
for(n = 0; n < 6; ++n)
36
{
37
bitoff[n] = (sum += blen*p2);
38
++blen; p2 <<= 1;
39
}
40
/* compute possible keys */
41
for(period=1; period <= maxperiod; ++period)
42
{
43
if(N < 30*period)
44
{
45
fprintf(stderr,
46
"file too short(%d bytes) for period (%d) - search
stopped. \ n",
47
N, period);
48
exit(1);
49
}
fprintf(stderr, " %2d \ r", period); fflush(stderr);
50
51
tree_search(period, 0);
52
}
printf("%d recursive calls \ n", tcnt);
53
54
return 0;
55
}
Figure 3.15: ( continued )
Search WWH ::




Custom Search