public AESBlock Decrypt(AESBlock chipherBlock) { AESBlock outputBlock = new AESBlock(chipherBlock); for (int r = 0; r < ROUND_NO; ++r) { outputBlock.AddRoundKey(roundKeys[ROUND_NO - r]); if (r > 0) { outputBlock.inverseMixColumns(); } outputBlock.InverseShiftRows(); outputBlock.SubBytesInverse(); } outputBlock.AddRoundKey(roundKeys[0]); return(outputBlock); }
public AESBlock Encrypt(AESBlock inputBlock) { AESBlock chipherBlock = new AESBlock(inputBlock); chipherBlock.AddRoundKey(roundKeys[0]); for (int r = 0; r < ROUND_NO; ++r) { chipherBlock.SubBytesForward(); chipherBlock.ShiftRows(); if (r < ROUND_NO - 1) { chipherBlock.MixColumns(); } chipherBlock.AddRoundKey(roundKeys[r + 1]); } return(chipherBlock); }