Main Page | Namespace List | Data Structures | File List | Data Fields | Globals

nzCipherText Class Reference

Class for 26-letter ciphertexts, with language identification. More...

#include <cipher.h>


Public Member Functions

 nzCipherText ()
 default constructor
 nzCipherText (string tName)
 constructor with ciphertext title
 nzCipherText (string tText, string tName)
 constructor with text and title
void reset ()
 clear text and frequencies
void setName (string tName)
 set ciphertext title
void add (char addChar)
 add a character
void add (int charCode)
 add a character passing its alphabetical index [0-25]
void add (string strIn)
 add a string
void addFile (const char *fName)
 add contents of file fName
void blockPrint ()
 print text in blocks of 5
double getEnglishChi2 ()
 get chi2 with respect to frequencies of the English language
double getFrenchChi2 ()
 get chi2 with respect to frequencies of the French language
double getUniformChi2 ()
 get chi2 with respect to the frequency of random letters (1/26)
double getReflectorChi2 ()
 get chi2 with respect to the frequencies of a reflector-based cipher machine
string str ()
 return text as string
void writeFreqTable (const char *outFile)
 write frequency table to file

Private Member Functions

string stripText (string strIn)
 remove all non-alphabetical characters, convert all to lowercase
string identify ()
 identify language, based on minimal chi2
int getMinIndex (vector< double > vect)
 return index of smallest vector entry

Private Attributes

string text
 the text proper
string name
 title of the ciphertext (eg NeMa ciphertext, english plaintext, ...)
int freq [26]
 letter frequencies of the text


Detailed Description

Class for 26-letter ciphertexts, with language identification.


Constructor & Destructor Documentation

nzCipherText::nzCipherText  ) 
 

default constructor

nzCipherText::nzCipherText string  tName  ) 
 

constructor with ciphertext title

nzCipherText::nzCipherText string  tText,
string  tName
 

constructor with text and title


Member Function Documentation

void nzCipherText::add string  strIn  ) 
 

add a string

void nzCipherText::add int  charCode  ) 
 

add a character passing its alphabetical index [0-25]

void nzCipherText::add char  addChar  ) 
 

add a character

void nzCipherText::addFile const char *  fName  ) 
 

add contents of file fName

void nzCipherText::blockPrint  ) 
 

print text in blocks of 5

double nzCipherText::getEnglishChi2  ) 
 

get chi2 with respect to frequencies of the English language

double nzCipherText::getFrenchChi2  ) 
 

get chi2 with respect to frequencies of the French language

int nzCipherText::getMinIndex vector< double >  vect  )  [private]
 

return index of smallest vector entry

double nzCipherText::getReflectorChi2  ) 
 

get chi2 with respect to the frequencies of a reflector-based cipher machine

double nzCipherText::getUniformChi2  ) 
 

get chi2 with respect to the frequency of random letters (1/26)

string nzCipherText::identify  )  [private]
 

identify language, based on minimal chi2

void nzCipherText::reset  ) 
 

clear text and frequencies

void nzCipherText::setName string  tName  )  [inline]
 

set ciphertext title

string nzCipherText::str  )  [inline]
 

return text as string

string nzCipherText::stripText string  strIn  )  [private]
 

remove all non-alphabetical characters, convert all to lowercase

void nzCipherText::writeFreqTable const char *  outFile  ) 
 

write frequency table to file


Field Documentation

int nzCipherText::freq[26] [private]
 

letter frequencies of the text

string nzCipherText::name [private]
 

title of the ciphertext (eg NeMa ciphertext, english plaintext, ...)

string nzCipherText::text [private]
 

the text proper


The documentation for this class was generated from the following files: