//public static MatrixField CreateParityMatrixBig(List<Block<byte>> dataBlocks, int parityBlockCount) //{ // int totalBlocks = dataBlocks.Count + parityBlockCount; // if (totalBlocks > 256) // { // throw new InvalidOperationException("A total of more then 256 blocks is not supported"); // } // var theMatrix = MatrixField.CreateIdentityMatrix(dataBlocks.Count + parityBlockCount); // //Copy parity part of the matrix // for (byte column = 0; column < dataBlocks.Count; column++) // { // for (byte row = 0; row < parityBlockCount; row++) // { // var val = Field.pow(new Field((byte)(column + Base)), row); // theMatrix[row + dataBlocks.Count, column] = val; // } // } // return theMatrix; //} public static MatrixField CreateParityOnlyMatrix(List <Block <byte> > dataBlocks, int parityBlockCount) { int totalBlocks = dataBlocks.Count + parityBlockCount; if (totalBlocks > 256) { throw new InvalidOperationException("A total of more then 256 blocks is not supported"); } var parityMatrixArray = new Field[parityBlockCount, dataBlocks.Count]; var baseList = BaseCalculator.CalcBase(8).ToList(); //Copy parity part of the matrix for (byte column = 0; column < parityMatrixArray.GetLength(1); column++) { for (byte row = 0; row < parityBlockCount; row++) { //var val = Field.pow(new Field((byte)(column + Base)), row); var val = Field.pow(baseList[column], (byte)(row + 1)); parityMatrixArray[row, column] = val; } } return(new MatrixField(parityMatrixArray)); }
public static void Main(string[] args) { Console.WriteLine("Hello World!"); var baseListTest = BaseCalculator.CalcBase(8).ToList(); var rrrrrr = string.Join($"{Environment.NewLine}", baseListTest); byte aa = 0; aa ^= 0x11D & 0xFF; byte ding = 0x11D & 0xFF; var test1 = GFTable.GFTable8; var result = test1.Add(5, 10); result = test1.Mul(10, 5); var res2 = test1.Add(250, 50); }