Example #1
0
int main() {
    char fileName[] = "inputFileE";
    int list[27] = {0};
    int totalChars = getCharacterFreq(fopen(fileName,"r"),list);

    /*print freq list*/
    int i;
    for(i = 0; i < 27; i++) {
        float percent = (float)list[i] / (float)totalChars;
        if(i == 26) {
            printf("%c \t",32);
        }
        else {
            printf("%c\t",i+97);
        }

        printf("%d\t",list[i]);
        printf("%f \n",percent);
    }

    decryptText(fopen(fileName,"r"));
    //encryptText(fopen("inputFileE","r"));

    return (0);
}
Example #2
0
VigenereCipherTab::VigenereCipherTab(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::VigenereCipherTab)
{
    ui->setupUi(this);

    connect(ui->btnDecrypt, SIGNAL(clicked()), this, SLOT(decryptText()));
    connect(ui->spinBox, SIGNAL(valueChanged(int)), this, SLOT(splitText(int)));
    connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setSubDict(int)));
    connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(setSubShift(int)));
}