实验三CRC校验
一、CRC校验码的基本源理
编码过程:
CRC校验码的编码方法是用待发送的二进制数据t(x)除以生成多项式g(x),将最后的余数作为CRC校验码。
其实现步骤以下:
1设待发送的数据块是mtes(str);returnByteToHex(bTemp,);
}
///<summary>
.
16进制转字符串
</summary>
<paramname="str">16进制</param>
<returns></returns>
publicstaticstringHexToStr(stringstr)
{
byte[]bytes=newbyte[];
bytes=HexToByte(str);
(bytes);
}
}
}
namespaceCRC
{
//哈夫曼树150
结点类Node的定义以下:
publicclassNode
{
privateintweight;//结点权值
privateintlChild;//左孩子结点
privateintrChild;//右孩子结点
privateintparent;//父结点
//结点权值属性
publicintWeight
{
get
{
returnweight;
}
set
{
weight=value;
}
}
//左孩子结点属性
publicintLChild
.
{
get
{
returnlChild;
}
set
{
lChild=value;
}
}
//右孩子结点属性
publicintRChild
{
get
{returnrChild;}
set{rChild=value;}}
//父结点属性
publicintParent
{get
{returnparent;}
set{
parent=value;}}
//结构器
publicNode()
{
weight=0;lChild=-1;
rChild=-1;parent=-1;}
//结构器
publicNode(intw,intlc,intrc,intp)
{
weight=w;
lChild=lc;
rChild=rc;
parent=p;
}
}
publicclassHuffmanTree
.
{
privateList<Node>data=newList<Node>();//结点数组privateintleafNum;//叶子结点数量
//索引器
publicNodethis[intindex]
{
CRC校验实验报告 来自淘豆网m.daumloan.com转载请标明出处.