public static Matrix XOR(Matrix a, Matrix b) { Matrix c = new Matrix(a.Rows, a.Columns); for (int i = 0; i < c.Rows; i++) { for (int j = 0; j < c.Columns; j++) { c[i, j] = MultiplicativeInverse.XOR(a[i, j], b[i, j]); } } return(c); }
public static string GetInverse(string text1, string text2, string mx, int n) { string[] multiplyTable = new string[n]; if (text1.IndexOf('1') > text2.IndexOf('1')) { string temp = text2; text2 = text1; text1 = temp; } multiplyTable[0] = text1; for (int i = 1; i < n; i++) { multiplyTable[i] = MultiplicativeInverse.LeftShift2(multiplyTable[i - 1], n); if (multiplyTable[i - 1][text1.Length - n].Equals('1')) { multiplyTable[i] = MultiplicativeInverse.XOR(multiplyTable[i], mx); } } string Mul_Inverse = ""; for (int i = 0; i < text2.Length; i++) { if (text2[i].Equals('1')) { if (Mul_Inverse.Equals("")) { Mul_Inverse = multiplyTable[(text2.Length - 1) - i]; } else { Mul_Inverse = MultiplicativeInverse.XOR(Mul_Inverse, multiplyTable[(text2.Length - 1) - i]); } } } if (Mul_Inverse.Equals("")) { Mul_Inverse = "00000000"; } return(Mul_Inverse); }