Cryptography Reference
In-Depth Information
1 /* Crack encoded WordPerfect 5.1 files: newwpcrack <encoded_file
2
(C) R.Wobst (Dresden), @(#) 30.Oct 00:34
3*/
4 #include <stdio.h>
" \ 033[07m"
5 #define INVERS
/* switch on inverse printing */
" \ 033[0m"
6 #define NORMAL
/* return to normal printing */
7 #define HEADER
16
/* # of header bytes, variable */
8 #define MAXKEY
23
/* max. keylength (WP specific) */
9 #define MAXPLAIN 40
/* # of bytes in known plaintext
*/
10 #define PROBE
1024
/* portion of read plaintext */
11 main()
12
{
13
static unsigned int wp[MAXPLAIN] =
14
{
15
0xfb, 0xff, 0x05, 0x00, 0x32, 0x00, 0x100, 0x04,
16
0x00, 0x00, 0x100, 0x00, 0x100, 0x00, 0x00, 0x00,
17
0x42, 0x00, 0x00, 0x00, 0x100, 0x100, 0x100, 0x100,
18
0x00, 0x00, 0x100, 0x00, 0x00, 0x00, 0x100, 0x100,
19
0x100, 0x100, 0x00, 0x00, 0x100, 0x100, 0x00, 0x00
20
};
21
unsigned char b[PROBE];
22
unsigned int key[MAXPLAIN];
23
int len, m, k, bad, N;
24
fread(b, 1, HEADER, stdin);
/* Header: Name etc. */
25
N = fread(b, 1, PROBE, stdin);
26
if(N < MAXPLAIN) exit(1);
27
for(len=1; len <= MAXKEY; ++len)
/* test on keyword lengths
*/
28
{
29
/* construct periodic key from known bytes */
Figure 3.10: The newwpcrack.c program.
Search WWH ::




Custom Search