1/* 2# This program was written by and is copyright Alec Muffett 1991, 3# 1992, 1993, 1994, 1995, and 1996, and is provided as part of the 4# Crack v5.0 Password Cracking package. 5# 6# The copyright holder disclaims all responsibility or liability with 7# respect to its usage or its effect upon hardware or computer 8# systems, and maintains copyright as set out in the "LICENCE" 9# document which accompanies distributions of Crack v5.0 and upwards. 10*/ 11 12#include <stdio.h> 13#include <ctype.h> 14 15#ifdef USE_PWD_H 16#include <pwd.h> 17#endif /* USE_PWD_H */ 18 19#ifdef USE_SYS_TYPES_H 20#include <sys/types.h> 21#endif /* USE_SYS_TYPES_H */ 22 23#ifdef USE_SIGNAL_H 24#include <signal.h> 25#endif /* USE_SIGNAL_H */ 26 27#ifdef USE_STRING_H 28#include <string.h> 29#endif /* USE_STRING_H */ 30 31#ifdef USE_STRINGS_H 32#include <strings.h> 33#endif /* USE_STRINGS_H */ 34 35#ifdef USE_STDLIB_H 36#include <stdlib.h> 37#endif /* USE__H */ 38 39#ifdef USE_UNISTD_H 40#include <unistd.h> 41#endif /* USE_UNISTD_H */ 42 43#ifdef USE_MALLOC_H 44#include <malloc.h> 45#endif /* USE_MALLOC_H */ 46 47#ifdef USE_BZERO 48#define ClrMem(addr, cnt) bzero(addr, cnt) 49#else /* USE_BZERO */ 50#define ClrMem(addr, cnt) memset(addr, '\0', cnt) 51#endif /* USE_BZERO */ 52 53#ifndef NUMWORDS 54#define NUMWORDS 16 55#endif /* NUMWORDS */ 56 57#ifndef MAXWORDLEN 58#define MAXWORDLEN 32 59#endif /* MAXWORDLEN */ 60 61#define MAXBLOCKLEN (MAXWORDLEN * NUMWORDS) 62 63#ifndef STRINGSIZE 64#define STRINGSIZE 1024 65#endif /* STRINGSIZE */ 66 67#define STRCMP(a,b) ((a)[0]!=(b)[0]?1:strcmp((a),(b))) 68#define CRACK_TOLOWER(a) (isupper(a) ? tolower(a) : (a)) 69#define CRACK_TOUPPER(a) (islower(a) ? toupper(a) : (a)) 70 71typedef unsigned char int8; 72typedef unsigned short int int16; 73typedef unsigned long int int32; 74 75extern char dawgmagic[]; 76 77extern char **SplitOn(); 78extern char *Clone(); 79extern char *Mangle(); 80extern char *Trim(); 81extern char Chop(); 82extern char ChopNL(); 83extern int Debug(); 84extern int PackDAWG(); 85extern int ResetDAWG(); 86extern int UnPackDAWG(); 87 88/* ------------------------------------------------------------------ */ 89 90struct pi_header 91{ 92 int32 pih_magic; 93 int32 pih_numwords; 94 int16 pih_blocklen; 95 int16 pih_pad; 96}; 97 98typedef struct 99{ 100 FILE *ifp; 101 FILE *dfp; 102 FILE *wfp; 103 104 int32 flags; 105#define PFOR_WRITE 0x0001 106#define PFOR_FLUSH 0x0002 107#define PFOR_USEHWMS 0x0004 108#define PFOR_SHAME 0x0008 109#define PFOR_THESAKEOFTHECHILDREN 0x0010 110#define PFOR_T5 0x0020 111#define PFOR_APENNY 0x0040 /* pcl@ox.ac.uk */ 112 int32 hwms[256]; 113 struct pi_header header; 114 int count; 115 char data[NUMWORDS][MAXWORDLEN]; /* static arrays - ick! */ 116} 117PWDICT; 118 119extern PWDICT *PWOpen(); 120extern char *Mangle(); 121extern char *FascistCheck(); 122 123#define PW_WORDS(x) ((x)->header.pih_numwords) 124#define PIH_MAGIC 0x70775635 /* pwV5 - will change */ 125 126/* ------------------------------------------------------------------ */ 127