private static byte[][] GFInverse(byte[][] mtx) { byte det = GFDet(mtx); byte[][] result = new byte[mtx.Length][]; for (int i = 0; i < mtx.Length; i++) { result[i] = new byte[mtx.Length]; } for (int row = 0; row < mtx.Length; row++) { for (int col = 0; col < result[row].Length; col++) { byte minor = GFMinor(mtx, row, col); result[col][row] = GF.Divide(minor, det); } } return(result); }