private void CreateGenerator() { if (fieldGenerator != null) { return; } fieldGenerator = new BinaryFieldElement("0", 444); fieldGenerator.SetBit(443); fieldGenerator.SetBit(28); fieldGenerator.SetBit(3); fieldGenerator.SetBit(1); fieldGenerator.SetBit(0); }
private static void RemainderFromGenerator(BinaryFieldElement firstOperand, BinaryFieldElement result, BinaryFieldElement temporaryResult) { for (int coordinateIndex = temporaryResult.content.Count - 1; coordinateIndex >= 0; coordinateIndex--) { if (coordinateIndex < fieldGenerator.content.Count - 1) { break; } if (!temporaryResult.content[coordinateIndex]) { continue; } for (int divistionCoordinateIndex = 0; divistionCoordinateIndex < fieldGenerator.content.Count; divistionCoordinateIndex++) { temporaryResult.content[coordinateIndex - divistionCoordinateIndex] ^= fieldGenerator.content[fieldGenerator.content.Count - 1 - divistionCoordinateIndex]; } } for (int coordinateIndex = 0; coordinateIndex < firstOperand.content.Count; coordinateIndex++) { if (temporaryResult.content[coordinateIndex]) { result.SetBit(coordinateIndex); } } }
private void CreateGenerator() { if (fieldGenerator != null) return; fieldGenerator = new BinaryFieldElement("0", 444); fieldGenerator.SetBit(443); fieldGenerator.SetBit(28); fieldGenerator.SetBit(3); fieldGenerator.SetBit(1); fieldGenerator.SetBit(0); }
private static void RemainderFromGenerator(BinaryFieldElement firstOperand, BinaryFieldElement result, BinaryFieldElement temporaryResult) { for (int coordinateIndex = temporaryResult.content.Count - 1; coordinateIndex >= 0; coordinateIndex--) { if (coordinateIndex < fieldGenerator.content.Count - 1) break; if (!temporaryResult.content[coordinateIndex]) continue; for (int divistionCoordinateIndex = 0; divistionCoordinateIndex < fieldGenerator.content.Count; divistionCoordinateIndex++) { temporaryResult.content[coordinateIndex - divistionCoordinateIndex] ^= fieldGenerator.content[fieldGenerator.content.Count - 1 - divistionCoordinateIndex]; } } for (int coordinateIndex = 0; coordinateIndex < firstOperand.content.Count; coordinateIndex++) { if (temporaryResult.content[coordinateIndex]) { result.SetBit(coordinateIndex); } } }