//******************************************************************** // // Method: decrypt // Parameter: QString* cipher, read input from techniqueComboBox_2, input key // // Purpose: use Cyper to decrypt, return plaintext // //******************************************************************** QString* MainWindow::decrypt(QString* cipher) { Crypt c (cipher,&(ui->keyTextField_2->text()),format); switch (ui->techniqueComboBox_2->currentIndex()) { case 0: //Caesar c.caesar(DECRYPT); break; case 1: //Vigenère c.vigenere(DECRYPT); break; default: ui->keyTipLabel_2->setText("Decryption failed"); } return cipher; }
//******************************************************************** // // Method: encrypt // Parameter: QString* plain, read input from techniqueComboBox, input key // // Purpose: use Cyper to encrypt, return ciphertext // //******************************************************************** QString* MainWindow::encrypt(QString* plain) { Crypt c (plain,&(ui->keyTextField->text()),format); switch (ui->techniqueComboBox->currentIndex()) { case 0: //Caesar c.caesar(ENCRYPT); break; case 1: //Vigenère c.vigenere(ENCRYPT); break; default: ui->keyTipLabel->setText("Encryption failed"); } return plain; }