Cryptography Reference
In-Depth Information
1 /* crack vigenere ciphers of compressed files
2
(C) Reinhard Wobst, Dresden (Germany) @(#) 7.Nov 00:44, 1996
3
Usage: vigc_crk [max_keylength] <crypted_file
4*/
5 #include <stdio.h>
6 #include <ctype.h>
7 #include <memory.h>
8 #define HEADER
3
/* # of bytes in compress-header
*/
9 #define MAXPERIOD
64
/* max. key length */
10 #define MAXKEYS
64
/* max. # of stored keys */
11 #define MAXLEN
40960
/* max. portion of read source
*/
12 static void tree_search(), print_result();
13 static unsigned char buf[MAXLEN],
/* ciphertext */
14
key[MAXPERIOD];
/* key field */
15 static N, maxperiod;
16 static tcnt=0;
17 static long bitoff[6], blenmsk[17] =
18
{
19
0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l,
/* dummy */
20
0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff, 0xffff
21
/* indices 9...16 */
22
};
23 main(argc, argv)
24
char *argv[];
25
{
26
int period, n, blen;
27
long p2, sum;
||
||
28
if(argc != 2
sscanf(argv[1], "%d", &maxperiod) != 1
29
maxperiod < 1
||
maxperiod > MAXPERIOD)
Figure 3.15: Using vigc crk.c to break a Vigenere-encrypted compressed file.
Search WWH ::




Custom Search