Classes



TEXT


class TEXT
{
public:
    int  length;
    char *data;

    static int char2num(int c); // Convert ASCII -> Internal Representation
    static int num2char(int c); // Convert Internal Representation -> ASCII
    TEXT(char *filename);       // Constructor: Loads File and Converts
    ~TEXT();                    // Destructor
    int Length();		// Return Length of File
    int Char(int i);            // Returns Character at Given Position
    void PrintVign(ostream& o, int linelen, VIGN *v);
				// Print File Vignere Encoded
    void PrintPerm(ostream& o, PERM *p, int linelen);
				// Print File Substitution Encoded
   void PrintPerm(ostream& o,PERM *p, int start, int end);
				// Print Parts of File Substitution Encoded

PERM


class PERM
{
public:
    int table[32];

    PERM(int t[32]);		// Constructor: Copy Given Perm
    PERM();			// Constructor: Identity Perm
    void Swap(int i, int j);	// Do Transposition
    int Translate(int c);       // Apply Permutation to Character 
    void Randomize();           // Randomize Permutation
    void LocalRandomize();      // Randomize Permutation Locally
    void Print(ostream& o);	// Print Permutation
};

VIGN


class VIGN
{
public:
    int table[256];
    int len;

    VIGN(int l);		// Constructor: Zero Key
    int Length();               // Return Key Length
    void Set(int pos, int val); // Set Key Element
    int Get(int pos); 		// Get Key Element
    int Translate(int c, int pos);
				// Translate Character at Given Position
    void PrintVign(ostream& o); // Print Key and its Inverse
};

STAT


class STAT
{
public:
    
    int stat1[32];
    int stat2[32][32];
    int stat3[32][32][32];

    STAT(char *filename, int penalty);	
		// Constructor
    int EvalTextPerm1( TEXT *t, PERM *p);
		// Score Text Based on Monograms After Substitution Encryption
    int EvalTextPerm3( TEXT *t, PERM *p );
		// Score Text Based on Trigrams After Substitution Encryption
    int EvalTextVign3( TEXT *t, VIGN *v);
		// Score Text Based on Trigrams After Vigenere Encryption
};

DICT


class DICT
{
public:

    uint32 table[2][HASHSIZE/32];   /* double bloom filter */

    static uint32 hash1(PERM *p,char *string, int len);
    static uint32 hash2(PERM *p,char *string, int len);
		// Hash Functions used for Blum-Filter

    DICT(char *filename, int maxlength);
		// Constructor
    int EvalTextPerm( TEXT *t, PERM *p, int weight, int maxlength);
		// Score Text Based on Dictionary After Substitution Encryption	
};

Last Update: 18.04.96 (Format: DD.MM.YY)