public static Block[,] createCorrectAndFaultyData(Block plainText, Block key) { Block [,] result = new Block[50, 2]; LED LBC = new LED(); for (int i = 0; i < 50; i++) { result[i, 0] = LBC.encryptionWithoutPrint(plainText, key, false); result[i, 1] = LBC.encryptionWithoutPrint(plainText, key, true); } return(result); }
static void Main(string[] args) { // Convert Key And PlainText And CipherText To Program's Format : int[,] plain = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } }; Block plainText = new Block(plain); int[,] cipher = { { 15, 13, 13, 6 }, { 15, 11, 9, 8 }, { 4, 5, 15, 8 }, { 1, 4, 5, 6 } }; Block cipherText = new Block(cipher); int[,] k = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } }; Block key = new Block(k); // Construct a LED object and execute Inc/Dec Method : LED led = new LED(); // Encryption & Decryption Methods : // led.encryption(plainText, key); // led.decryption(cipherText , key); // Construct an IMFA object and execute the analysis : IMFA analysis = new IMFA(); // Fault Injecting : Block[,] data = IMFA.createCorrectAndFaultyData(plainText, key); // Impossible Meet-In-The-Middle Fault Analysis on LED Lightweight Cipher : analysis.execute(data); // Calculate None-Zero Nibbles in MixColumnSerial level (Round r - 2) : // IMFA.showTable(IMFA.noneZeroNibblesTable()); }
public static Block IMC(Block plain_text) { return(LED.mixColumnSerial(plain_text, IMDS)); }
public static Block ISR(Block plain_text) { return(LED.shiftRows(plain_text, inverseLeftShift)); }
public static Block ISC(Block plain_text) { return(LED.subCells(plain_text, iSBox)); }
public static Block IAC(Block plain_text, int round_number) { return(LED.addConstant(plain_text, round_number, false)); }
public static Block SR(Block plain_text) { return(LED.shiftRows(plain_text, leftShift)); }