Cryptography Reference
In-Depth Information
1 /* crack vigenere ciphers by statistical methods
2
(C) Reinhard Wobst, Dresden (Germany) @(#) 30.Oct 22:57, 1996
3
Usage: vigcrack distr_file <crypted_file
4
The 'distr_file' must be generated by the program 'distr' from
5
a typical plaintext:
6
distr <plaintext >distr_file
7
The file plaintext must have typical character frequencies.
8
Not applicable for equally distributed plaintexts (gzip etc).
9
Output: One proposed keyword, trust value (the higher, the
better).
10
A trust value near 1 indicates insecure password detection.
11 */
12 #include <stdio.h>
13 #include <ctype.h>
14 #include <memory.h>
15 #define MAXPERIOD
64
/* max. key length */
16 #define MAXLEN
40960
/* max. portion of read source */
17 #define THRESH
0.1
/* "threshold factor for max.
probability" */
18 #define PERC
0.01
/* 1% - kappa (coeff. of coincidence)
*/
19 main(argc, argv)
20
char *argv[];
21
{
22
unsigned char buf[MAXLEN], key[MAXPERIOD+1],
23
*p;
24
register n, m;
25
int n0, c, off, indx, period, kappacnt, N, Np,
26
cnt[256];
Figure 3.13: Using vigcrack to break a Vigenere cipher.
Search WWH ::




Custom Search