当前位置:网站首页>CRC check
CRC check
2022-07-01 10:15:00 【Ennuyeux】
1. Généralités:
LedemoPrincipales réalisationsCRCVérification
RéférencesCRCL'adresse de la bibliothèque est:https://github.com/whik/crc-lib-c
2. Tests:
/* demo_crc.c crc demo : CRC Vérification Références crcLib.h crcLib.c github Adresse : https://github.com/whik/crc-lib-c */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "crcLib.h"
int main(int argc, char *argv[]) {
char str[16] = "Hello World!";
printf("crc4_itu\t \"%s\" = 0x%0X\n", str, crc4_itu((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc5_epc\t \"%s\" = 0x%0X\n", str, crc5_epc((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc5_itu\t \"%s\" = 0x%0X\n", str, crc5_itu((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc5_usb\t \"%s\" = 0x%0X\n", str, crc5_usb((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc6_itu\t \"%s\" = 0x%0X\n", str, crc6_itu((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc7_mmc\t \"%s\" = 0x%0X\n", str, crc7_mmc((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc8\t\t \"%s\" = 0x%0X\n", str, crc8((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc8_itu\t \"%s\" = 0x%0X\n", str, crc8_itu((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc8_rohc\t \"%s\" = 0x%0X\n", str, crc8_rohc((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc8_maxim\t \"%s\" = 0x%0X\n", str, crc8_maxim((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_ibm\t \"%s\" = 0x%0X\n", str, crc16_ibm((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_maxim\t \"%s\" = 0x%0X\n", str, crc16_maxim((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_usb\t \"%s\" = 0x%0X\n", str, crc16_usb((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_modbus\t \"%s\" = 0x%0X\n", str, crc16_modbus((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_ccitt\t \"%s\" = 0x%0X\n", str, crc16_ccitt((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_ccitt_false\t \"%s\" = 0x%0X\n", str, crc16_ccitt_false((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_x25\t \"%s\" = 0x%0X\n", str, crc16_x25((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_xmodem\t \"%s\" = 0x%0X\n", str, crc16_xmodem((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_dnp\t \"%s\" = 0x%0X\n", str, crc16_dnp((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc32\t\t \"%s\" = 0x%0X\n", str, crc32((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc32_mpeg_2\t \"%s\" = 0x%0X\n", str, crc32_mpeg_2((uint8_t *)str, (uint16_t)(strlen(str))));
return 0;
}
#Makefile
CC := gcc
AR := ar
all:
$(CC) -c crcLib.c -o crcLib.o -Wall -Werror
$(AR) cr libcrcLib.a crcLib.o
#-L Spécifiez le chemin de la Bibliothèque -l Spécifiez le nom de la bibliothèque à connecter
#-Wl,-Bstatic Indique ce qui suit -lxxx Les options sont liées à des bibliothèques statiques
#-Wl,-Bdynamic Indique ce qui suit -lxxx Les options sont liées à des bibliothèques dynamiques
$(CC) demo_crc.c -o demo_crc -lm -L. -Wl,-Bstatic -lcrcLib -Wl,-Bdynamic -Wall -Werror
clean:
rm demo_crc *.o *.a
边栏推荐
- It is interesting to understand MMAP in this way!
- Kotlin 协程调度切换线程是时候解开真相了
- CSDN's one-stop cloud service is open for internal testing, and new and old users are sincerely invited to grab the fresh
- 硬件中台项目
- Kotlin coprocessor scheduling switch threads it's time to unravel the truth
- 零基础入行软件测试必看,10年测试老鸟的良心建议(共15条)
- Continue to advance, and softcom power steadily promotes cloud intelligence strategy
- Tearful eyes, it's not easy to change jobs. Three rounds of interviews, four hours of soul torture
- 基于Matlab的开环Buck降压斩波电路Simulink仿真电路模型搭建
- What is cloud primordial? Will it be the trend of future development?
猜你喜欢
Floyd repeat
uniapp微信小程序组件按需引入
Live broadcast management project
This is the best flash popular science article I have ever seen!
关于#SQL#的问题,如何解决?
What if the win11 account is locked and unable to log in? Win11 account is locked and unable to log in
程序员都想去国企?技术落后薪资低,躺平几年出来都找不到工作...
数字藏品新一轮热度开启
持续进阶,软通动力稳步推动云智能战略
scratch大鱼吃小鱼 电子学会图形化编程scratch等级考试二级真题和答案解析2022年6月
随机推荐
A quietly rising domestic software, low-key and powerful!
Tearful eyes, it's not easy to change jobs. Three rounds of interviews, four hours of soul torture
button按钮清除边框
CentOS configures discuz prompt, please check whether the MySQL module is loaded correctly
About widthstep of images in opencv
C one line code calculates the MD5 value of the file - codeplus series
SSH服务器拒绝密码,再试一次;PermitRootLogin yes无效问题
BSN long story 10: how to ensure the safety of NFT
IDEA运行报错Command line is too long. Shorten command line for...
MySQL common commands
Continue to advance, and softcom power steadily promotes cloud intelligence strategy
CSDN一站式云服务开放内测,诚邀新老用户来抢鲜
项目必用的全局异常处理器,你学会了吗
程序员都想去国企?技术落后薪资低,躺平几年出来都找不到工作...
How to understand JS promise
Drive away bad emotions and stop worrying
Dotnet console uses microsoft Maui. Getting started with graphics and skia
编写自己的who命令
The "China Mobile Chain" state secret engine was officially launched on BSN
数据库的增删改查问题