求帮忙把这一段c语言版的crc算法改为c#版,谢谢~

问题描述

constunsignedcharha00[256]={0x00,0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x81,0x91,0xA1,0xB1,0xC1,0xD1,0xE1,0xF1,0x12,0x02,0x32,0x22,0x52,0x42,0x72,0x62,0x93,0x83,0xB3,0xA3,0xD3,0xC3,0xF3,0xE3,0x24,0x34,0x04,0x14,0x64,0x74,0x44,0x54,0xA5,0xB5,0x85,0x95,0xE5,0xF5,0xC5,0xD5,0x36,0x26,0x16,0x06,0x76,0x66,0x56,0x46,0xB7,0xA7,0x97,0x87,0xF7,0xE7,0xD7,0xC7,0x48,0x58,0x68,0x78,0x08,0x18,0x28,0x38,0xC9,0xD9,0xE9,0xF9,0x89,0x99,0xA9,0xB9,0x5A,0x4A,0x7A,0x6A,0x1A,0x0A,0x3A,0x2A,0xDB,0xCB,0xFB,0xEB,0x9B,0x8B,0xBB,0xAB,0x6C,0x7C,0x4C,0x5C,0x2C,0x3C,0x0C,0x1C,0xED,0xFD,0xCD,0xDD,0xAD,0xBD,0x8D,0x9D,0x7E,0x6E,0x5E,0x4E,0x3E,0x2E,0x1E,0x0E,0xFF,0xEF,0xDF,0xCF,0xBF,0xAF,0x9F,0x8F,0x91,0x81,0xB1,0xA1,0xD1,0xC1,0xF1,0xE1,0x10,0x00,0x30,0x20,0x50,0x40,0x70,0x60,0x83,0x93,0xA3,0xB3,0xC3,0xD3,0xE3,0xF3,0x02,0x12,0x22,0x32,0x42,0x52,0x62,0x72,0xB5,0xA5,0x95,0x85,0xF5,0xE5,0xD5,0xC5,0x34,0x24,0x14,0x04,0x74,0x64,0x54,0x44,0xA7,0xB7,0x87,0x97,0xE7,0xF7,0xC7,0xD7,0x26,0x36,0x06,0x16,0x66,0x76,0x46,0x56,0xD9,0xC9,0xF9,0xE9,0x99,0x89,0xB9,0xA9,0x58,0x48,0x78,0x68,0x18,0x08,0x38,0x28,0xCB,0xDB,0xEB,0xFB,0x8B,0x9B,0xAB,0x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,0xFA,0x99,0xB8,0x5F,0x7E,0x1D,0x3C,0xD3,0xF2,0x91,0xB0,0x57,0x76,0x15,0x34,0x4C,0x6D,0x0E,0x2F,0xC8,0xE9,0x8A,0xAB,0x44,0x65,0x06,0x27,0xC0,0xE1,0x82,0xA3,0x7D,0x5C,0x3F,0x1E,0xF9,0xD8,0xBB,0x9A,0x75,0x54,0x37,0x16,0xF1,0xD0,0xB3,0x92,0x2E,0x0F,0x6C,0x4D,0xAA,0x8B,0xE8,0xC9,0x26,0x07,0x64,0x45,0xA2,0x83,0xE0,0xC1,0x1F,0x3E,0x5D,0x7C,0x9B,0xBA,0xD9,0xF8,0x17,0x36,0x55,0x74,0x93,0xB2,0xD1,0xF0};voidCRC(uchar*a,uchar*b,uchar*c){*c=la00[*a]^*c;*a=ha00[*a]^*b;*b=*c;}//--说明----有效数据(0x4D4D4DH+0xFFFFFFFFFFFFH+0xFFFFFFFFFFFFH)15字节长度//j–有效数据长度//s[0]-s[j-1]--有效数据(0x4D4D4DH+0xFFFFFFFFFFFFH+0xFFFFFFFFFFFFH)//s[j]-s[j+1]--CRC校验码(0x@@@@H)//i,CrcA,CrcB,CrcC--临时变量//--程序--CrcA=s[0];CrcB=s[1];CrcC=s[2];for(i=2;i<j;i++){CRC(&CrcA,&CrcB,&CrcC);CrcC=s[i+1];}s[j]=CrcA;s[j+1]=CrcB;//***************************************************************//这里以CRC-CCITT标准生成多项式。CRC-CCITT是一个17位生成多项式//G=[10001000000100001],用多项式形式表示为G(x)=x16+x12//+x5+1,由它产生的检验码R的二进制位数是16位(2字节)。

解决方案

解决方案二:
自己搞定,结贴
解决方案三:
代码都不全,然后应该是用ref
解决方案四:
接分,行不?

时间: 2024-10-10 19:03:33

求帮忙把这一段c语言版的crc算法改为c#版,谢谢~的相关文章

语言-新手求帮忙看下这段代码的数据溢出问题,没有C币理解下(我是在CodeBlock10.05下运行的)

问题描述 新手求帮忙看下这段代码的数据溢出问题,没有C币理解下(我是在CodeBlock10.05下运行的) #include #include #include unsigned int Ex_secret[30]={11,4,120,75,170,204,90,59,78,49,//用0~255的数表示8位2进制,一共240位 148,248,190,137,0,9,17,91,174,105,45,124,177,205,57,97,194,155,120,36}; unsigned in

操作符丢失错误-不太会改,求帮忙。visualc#的 我是小白 ,求帮忙

问题描述 不太会改,求帮忙.visualc#的 我是小白 ,求帮忙 百度说,不是字符型的 要这样改 sql="delete from users where userid=" & cint(request("userid")) 但是我的是select * form user where ID='" + textbox1.Text + "'and passward='" + textbox2.Text + "' 我不太会

c语言-我的一段C语言程序在VC6.0上面运行不出来,貌似是头文件的问题,求帮忙

问题描述 我的一段C语言程序在VC6.0上面运行不出来,貌似是头文件的问题,求帮忙 #include"C:UsershpDesktopcomplex.h" main() { complex *a; int N=1024; //给a赋值 fft(a,N) } int fft(complex *a,int l) { const double pai=3.141592653589793; complex u,w,t; unsigned n=1,nv2,nm1,k,le,lei,ip; uns

c++-C++如何转C语言,跪求帮忙转一下,在线等答案

问题描述 C++如何转C语言,跪求帮忙转一下,在线等答案 各位学长,能不能帮小妹做个作业啊,把C++转换为C语言//附合水准路线解算.cpp#include #include #include #include using namespace std; void Data_Calculate();//数据解算void Data_Show();//结果打印到屏幕void Data_Output();//结果输出到TXT int v[4] i=0;double h[4] L[4] h_v[4] H[

网页设计与开发-网页设计,有一段代码太冗长了,求帮忙优化下!!!感激不尽!!!

问题描述 网页设计,有一段代码太冗长了,求帮忙优化下!!!感激不尽!!! 在最底下的那一段script代码太冗长了,求帮忙优化下,感激不尽!!! 以下是己完成的代码: <!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> </head> <style> .explain_box{ float:lef

java源码-求这段c语言的代码换成java的代码

问题描述 求这段c语言的代码换成java的代码 #include #define P 3.1415927#define toFeet(x) x/12.0#define toMiles(x) x/5280.0int main(){ double diameter;//直径 int revolutions;//转数 double time;//香蕉 double s; int count=1; while(scanf("%lf%d%lf",&diameter,&revolu

高分悬赏 请大神指导-网上发现找到一组c语言代码,求帮忙整合成能用

问题描述 网上发现找到一组c语言代码,求帮忙整合成能用 #include #include #include #include #ifndef FUNCTION_H#define _FUNCITON_H_typedef struct student{ char nameStudent[10]; int numberSudent; int indexN; //已选数量 int elect[20]; //已选课题编号(多个) BOOL whetherNull;}STU;typedef struct

如何将word文档按段落分开?加方框号的是一段,剩下的是一段,,急求帮忙,有没有会的???

问题描述 如何将word文档按段落分开?加方框号的是一段,剩下的是一段,,急求帮忙,有没有会的??? [重 要 活 动] 东城公安分局15日召开"大干五十天誓保阅兵安全"誓师大会 市公安局党委副书记.副局长姜良栋,区领导杨柳荫.张家明.赵中原.邵鹏.金晖.陶晶.毛炯.陈之常.赵军.蓝向东参加.陶晶宣读有关决定,全体民警宣誓.姜良栋.杨柳荫.张家明为区公安分局安保团队授旗.姜良栋要求:1.精心组织,统筹谋划,充分发挥领导核心作用.做好应对各种复杂情况的思想准备和工作准备,将阅兵安保与强化

求c语言编写的经纬高转换成XYZ的程序,只要能简单运行的程序,悬赏20个币,求帮忙

问题描述 求c语言编写的经纬高转换成XYZ的程序,只要能简单运行的程序,悬赏20个币,求帮忙 求c语言编写的经纬高转换成XYZ的程序,只要能简单运行的程序,不要复杂的界面,悬赏20个币,求帮忙.程序要求能读取存储经纬高数据的文本,转换成XYZ存成文本,给力的话可以再加币,多谢多谢! 解决方案 纬度和高度都是可以直接转换的.只有经度,经度根据纬度可以换算,公式是cos(维度)*(赤道周长/360) 解决方案二: 以地球为严格的球体来做的话,以球心画出一个参考的三围坐标系,不难得到 #include