当前位置:网站首页>CRC verification
CRC verification
2022-07-01 10:15:00 【@Boring people】
1. summary :
The demo The main implementation CRC check
quote CRC The address of the library is :https://github.com/whik/crc-lib-c
2. test :
/* demo_crc.c crc demo : CRC check quote crcLib.h crcLib.c github Address : 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 Specify the path to the library -l Specify the name of the library to connect to
#-Wl,-Bstatic The instructions follow -lxxx Options are linked to static libraries
#-Wl,-Bdynamic The instructions follow -lxxx Options are linked to dynamic libraries
$(CC) demo_crc.c -o demo_crc -lm -L. -Wl,-Bstatic -lcrcLib -Wl,-Bdynamic -Wall -Werror
clean:
rm demo_crc *.o *.a
边栏推荐
- Prefabricated dishes usher in the "golden age", who can lead the next trillion market
- 项目必用的全局异常处理器,你学会了吗
- Can MySQL CDC take out the op field
- Fried money, lost 10million.
- About database: how to avoid deadlock in gbase 8s
- Who has the vision to cross the cycle?
- 历史上的今天:九十年代末的半导体大战;冯·诺依曼发表第一份草案;CBS 收购 CNET...
- SQL statement modify field type "suggestions collection"
- 亿学学堂帮个人开的证券账户安全吗?是不是有套路
- 线程基础知识
猜你喜欢

Today in history: the semiconductor war in the late 1990s; Von Neumann published the first draft; CBS acquires CNET

Have you learned the necessary global exception handler for the project

I like two men...

scratch大鱼吃小鱼 电子学会图形化编程scratch等级考试二级真题和答案解析2022年6月

Meituan P4 carefully collated microservice system architecture design manual to see the world of microservice architecture

数字藏品新一轮热度开启

机器学习之线性回归详解

Wechat emoticons are written into the judgment, and the OK and bomb you send may become "testimony in court"

渗透常用工具-Goby

零基础入行软件测试必看,10年测试老鸟的良心建议(共15条)
随机推荐
[fxcg] large scale job hopping may be one of the driving forces behind the soaring inflation in the United States
sql语句修改字段类型「建议收藏」
IDEA运行报错Command line is too long. Shorten command line for...
Who has the vision to cross the cycle?
《天天数学》连载55:二月二十四日
BSN长话短说之十:如何保证NFT的安全
Scratch big fish eat small fish Electronic Society graphical programming scratch grade examination level 2 true questions and answers analysis June 2022
How do clients request databases?
MySQL常用命令
请问有没有人知道clickhouse 中 limit语句执行的逻辑,图片中,上面的SQL可以执行成功
Common penetration tools -goby
北汽蓝谷:业绩承压,极狐难期
Today in history: the semiconductor war in the late 1990s; Von Neumann published the first draft; CBS acquires CNET
CSDN一站式云服务开放内测,诚邀新老用户来抢鲜
Live broadcast management project
About database: how to avoid deadlock in gbase 8s
Centos 配置discuz 提示请检查 mysql 模块是否正确加载
A quietly rising domestic software, low-key and powerful!
tryhackme圣诞挑战2021-Advent of Cyber 3-day1-IDOR漏洞,不安全的访问控制漏洞
Fried money, lost 10million.