Cryptography Reference
In-Depth Information
\
"", period);
147
printf("period: %d, PROPOSED KEY:
148
for(n=0; n < period; ++n)
149
{
150
c = key[n];
151
if(iscntrl(c)) printf("^%c", c+'@');
152
else putchar(c);
153
}
printf("
\
"
\
n%s", kd);
154
155
for(n=0; n < period;)
156
{
157
c = key[n];
158
if(c == ' ')
printf("
");
159
else if(c == '
\
n')
printf("
\\
n ");
160
else if(c == '
\
r')
printf("
\\
r ");
161
else if(c == '
\
t')
printf("
\\
t ");
162
else if(isprint(c)) printf("%c
", c);
163
else if(iscntrl(c)) printf("^%c ", c+'@');
164
else
printf("%02x ", c);
165
if(!(++n&0xf))
166
{
putchar('
\
n');
167
168
for(m=strlen(kd); m--;) putchar(' ');
169
}
170
}
printf("
\
n
\
n");
171
172
}
Figure 3.15:
(
continued
)
•
If this relation for the character is met in all periods, then these first
n
+
1 characters could be the beginning of a valid password. We repeat
the last step with all 256 possible (
n
+
2)th characters. (If
n
is sufficiently
large — see below — we'd even have found a password.)
If the relation for the character is not met in at least one period, then we
try our luck with the next (
n
+
1)th character.