예제 #1
0
파일: ECC.cs 프로젝트: gxk/dm6467
        // *************************************************
        // *             Public Class Methods              *
        // *************************************************

        public static BinaryGaloisFieldElement[] createGeneratorPolynomial(BinaryGaloisField gf, Int32 maxCorrectibleErrorCnt)
        {
            // Generator polynomial, g(x), is of order 2s, so has 2s+1 coefficients
            BinaryGaloisFieldElement[] g = new BinaryGaloisFieldElement[2 * maxCorrectibleErrorCnt + 1];

            // Make g(x) = 1
            g[0] = 1;
            for (int i = 1; i <= (2 * maxCorrectibleErrorCnt); i++)
            {
                // Always make coefficient of x^i term equal to 1
                g[i] = 1;

                // Below multiply (g(x) = g[0] + g[1]*x + ... + g[i]*(x^i)) by (x - alpha^i)
                for (int j = (i - 1); j > 0; j--)
                {
                    if (g[j] != 0)
                    {
                        g[j] = g[j - 1] - gf.Multiply(gf.AlphaFromIndex(i), g[j]);
                    }
                    else
                    {
                        g[j] = g[j - 1];
                    }
                }
                // Coefficient of x^0 term is alpha^(1+2+...+i)
                g[0] = gf.AlphaFromIndex(((i * (i + 1)) / 2));
            }
            return(g);
        }
예제 #2
0
파일: ECC.cs 프로젝트: gxk/dm6467
        // *************************************************
        // *            Private Constructors               *
        // *************************************************


        // *************************************************
        // *               Private Methods                 *
        // *************************************************


        // *************************************************
        // *        Public properties and Indexer          *
        // *************************************************


        // *************************************************
        // *             Public constructors               *
        // *************************************************

        public ReedSolomonECC(Int32 msgSymbolCnt, Int32 maxCorrectibleErrorCnt, Byte symbolBitWidth)
        {
            k = msgSymbolCnt;
            s = maxCorrectibleErrorCnt;
            N = k + 2 * s;

            // Create Binary Galois Field ( that is GF(2^symbolBitWidth) )
            galoisField = new BinaryGaloisField(symbolBitWidth);

            // Create the generator polynomial, g(x)
            generatorPoly = ReedSolomonECC.createGeneratorPolynomial(galoisField, maxCorrectibleErrorCnt);
        }
예제 #3
0
파일: ECC.cs 프로젝트: shenbokeji/SinoMT
 // *************************************************
 // *             Public Class Methods              *
 // *************************************************
 
 public static BinaryGaloisFieldElement[] createGeneratorPolynomial(BinaryGaloisField gf, Int32 maxCorrectibleErrorCnt)
 {
   // Generator polynomial, g(x), is of order 2s, so has 2s+1 coefficients
   BinaryGaloisFieldElement[] g = new BinaryGaloisFieldElement[2*maxCorrectibleErrorCnt + 1];
   
   // Make g(x) = 1
   g[0] = 1;
   for (int i = 1; i<=(2*maxCorrectibleErrorCnt); i++)
   {
     // Always make coefficient of x^i term equal to 1
     g[i] = 1;
     
     // Below multiply (g(x) = g[0] + g[1]*x + ... + g[i]*(x^i)) by (x - alpha^i)
     for (int j=(i-1); j > 0; j--)
     {
       if (g[j] != 0)
         g[j] = g[j - 1] - gf.Multiply(gf.AlphaFromIndex(i),g[j]);
       else
         g[j] = g[j - 1];
     }
     // Coefficient of x^0 term is alpha^(1+2+...+i)
     g[0] = gf.AlphaFromIndex( ((i*(i+1))/2) );
   }
   return g;
 }
예제 #4
0
파일: ECC.cs 프로젝트: shenbokeji/SinoMT
      // *************************************************
      // *            Private Constructors               *
      // *************************************************
      
      
      // *************************************************
      // *               Private Methods                 *
      // *************************************************

      
      // *************************************************
      // *        Public properties and Indexer          *
      // *************************************************


      // *************************************************
      // *             Public constructors               *
      // *************************************************

      public ReedSolomonECC(Int32 msgSymbolCnt, Int32 maxCorrectibleErrorCnt, Byte symbolBitWidth)
      {
        k = msgSymbolCnt;
        s = maxCorrectibleErrorCnt;
        N = k + 2*s;
        
        // Create Binary Galois Field ( that is GF(2^symbolBitWidth) )
        galoisField = new BinaryGaloisField(symbolBitWidth);
        
        // Create the generator polynomial, g(x)
        generatorPoly = ReedSolomonECC.createGeneratorPolynomial(galoisField, maxCorrectibleErrorCnt);
      }