public static byte[] GetErrorCorrectionBytes(ArraySegment <byte> input, int numErrorCorrectionBytes)
 {
     // In Reed-Solomon, the error correction bytes are the remainder once the input
     // (which has been multiplied by x^n) is divided by g_n(x) over GF(2^8).
     byte[] shiftedInput = new byte[input.Count + numErrorCorrectionBytes];
     input.CopyToArray(shiftedInput);
     byte[] generatorPolynomial = GetGeneratorPolynomial(numErrorCorrectionBytes);
     return(_qrGaloisField.PolyMod(shiftedInput, generatorPolynomial));
 }
 public static byte[] GetErrorCorrectionBytes(ArraySegment<byte> input, int numErrorCorrectionBytes)
 {
     // In Reed-Solomon, the error correction bytes are the remainder once the input
     // (which has been multiplied by x^n) is divided by g_n(x) over GF(2^8).
     byte[] shiftedInput = new byte[input.Count + numErrorCorrectionBytes];
     input.CopyToArray(shiftedInput);
     byte[] generatorPolynomial = GetGeneratorPolynomial(numErrorCorrectionBytes);
     return _qrGaloisField.PolyMod(shiftedInput, generatorPolynomial);
 }
Exemple #3
0
        public static ArraySegment <byte> Copy(this ArraySegment <byte> arraySegment)
        {
            var array = arraySegment.CopyToArray();

            return(new ArraySegment <byte>(array, 0, array.Length));
        }