//private string FromChars(char[,] chars) //{ // string str = ""; // char c; // for (int i = 0; i < chars.GetLength(0); i++) // { // for (int j = 0; j < chars.GetLength(1); j++) // { // c = chars[i, j]; // if (chars[i, j] == '"') // str += "\""; // else // str += chars[i, j]; // } // } // return str; //} public char[] Encrypt(string plaintext) { MWArray ciphertext = (MWArray)this.aesMatObj.AESEncrypt((MWArray)plaintext, CipherKey, SboxDec, Rcon, MatMixCol); char[,] ctchars = (char[, ])ciphertext.ToArray(); char[] chars = MatricesFactory.To1D(ctchars); return(chars); }
public char[] Decrypt(char[] ciphertext) { double[] ciphervector = BitManipulator.CharToDouble(ciphertext); //MWArray[] mw = this.aesMatObj.AESDecrypt(2, (MWNumericArray)(MatricesFactory.To2D(ciphervector)), CipherKey, SboxDec, SboxInv, Rcon, MatMixColInv); //MWNumericArray mn = (MWNumericArray)mw[1]; MWArray plaintext = (MWArray)this.aesMatObj.AESDecrypt((MWNumericArray)(MatricesFactory.To2D(ciphervector)), CipherKey, SboxDec, SboxInv, Rcon, MatMixColInv); char[,] plaintextchars = (char[, ])plaintext.ToArray(); return(MatricesFactory.To1D(plaintextchars)); }