如果是的话
using System;namespace mainClass
{
    public class mainProgress
    {
        public static void Main()
        {
            byte[] msg={1,0,1,1,0,0,1};//信息码
            byte[] gmsg=new byte[msg.Length+4];
            crc c = new crc();
            gmsg=c.code(msg);
            Console.Write("编码后字符串为:");
            for (int i = 0; i < gmsg.Length; i++)
            {
                Console.Write("{0}", gmsg[i].ToString());
            }
            Console.Write("\n");
            byte[] gmsg1={ 1, 0, 1, 1, 0, 1, 1 };//接收到的代码
            bool r = c.det(gmsg1);
            if (r)
            {
                Console.WriteLine("传输正确");
            }
            else
            { Console.WriteLine("传输错误"); }
        }
    }
    public class crc//CRC编码类
    {
        private byte[] g = { 1,1,0,0,1};//生成码
        public byte[] code(byte[] msg)//编码
        {
            byte[] gmsg=new byte[g.Length+msg.Length-1];
            msg.CopyTo(gmsg, 0);//
            for (int i = 0; i < msg.Length; i++)//完成异或运算,即模2除法
            {
                if (gmsg[i] == 1)
                {
                    for (int j = 0; j < g.Length; j++)
                    {
                        if (gmsg[i + j] == g[j])
                            gmsg[i + j] = 0;
                        else
                            gmsg[i + j] = 1;
                    }
                }
            }
            msg.CopyTo(gmsg, 0);
            return gmsg;
        }
        private bool f=true;        //接收端检测
        public bool det(byte[] gmsg)
        {
            for (int i = 0; i < gmsg.Length - g.Length+1; i++)
            {
                if(gmsg[i]==0)
                    continue;
                for (int j = 0; j < g.Length; j++)
                {
                    if (gmsg[i + j] == g[j])
                        gmsg[i + j] = 0;
                    else
                        gmsg[i + j] = 1;
                }
            }
            for (int i = 0; i < gmsg.Length; i++)
            {
                if (gmsg[i] == 1)
                    f = false;
            }
            return f;
        }    }
}