当前位置:网站首页>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
边栏推荐
- Floyd repeat
- Win11账号被锁定无法登录怎么办?Win11账号被锁定无法登录
- How do clients request databases?
- 7-Zip 遭抵制?呼吁者定下“三宗罪”:伪开源、不安全、作者来自俄罗斯!
- Prefabricated dishes usher in the "golden age", who can lead the next trillion market
- Ubuntu系统安装与配置MySQL
- About database: how to avoid deadlock in gbase 8s
- Postgraduate entrance examination vocabulary 2023 sharing (1)
- 京东与腾讯续签三年战略合作协议;起薪涨至26万元!韩国三星SK争相加薪留住半导体人才;Firefox 102 发布|极客头条...
- The "China Mobile Chain" state secret engine was officially launched on BSN
猜你喜欢

谁还在买“三只松鼠”们

数字藏品平台搭建需要注意哪些法律风险及资质?

Can you afford to buy a house in Beijing, Shanghai, Guangzhou and Shenzhen with an annual salary of 1million?

What a high commission! The new programmer's partner plan is coming. Everyone can participate!

Precautions for lvgl v8.2 string display on keil MDK (take little bear pie as an example)

venv: venv 的目录结构

Programmers want to go to state-owned enterprises? The technology is backward and the salary is low. I can't find a job after lying flat for several years

JD and Tencent renewed the three-year strategic cooperation agreement; The starting salary rose to 260000 yuan! Samsung sk of South Korea competes for salary increase to retain semiconductor talents;

C one line code calculates the MD5 value of the file - codeplus series

机器学习之线性回归详解
随机推荐
全球基金和资管的股票建仓率达到15年内新低
怎么理解JS Promise
Common penetration tools -goby
The "China Mobile Chain" state secret engine was officially launched on BSN
C one line code calculates the MD5 value of the file - codeplus series
[dark horse morning post] Yu Minhong said he never looked at the stock price of New Oriental; Hengchi 5 will start pre-sale in July; Naixue virtual stock or suspected of illegal fund-raising; From Jul
编写自己的who命令
Zero foundation software testing must see, 10 years of testing old bird's conscience suggestions (a total of 15)
Kotlin coprocessor scheduling switch threads it's time to unravel the truth
Apple amplification! It's done so well
亿学学堂帮个人开的证券账户安全吗?是不是有套路
Programmers want to go to state-owned enterprises? The technology is backward and the salary is low. I can't find a job after lying flat for several years
MySQL common commands
What if the win11 account is locked and unable to log in? Win11 account is locked and unable to log in
In terms of use
哪个券商公司炒股开户佣金低又安全又可靠
SQL statement modify field type "suggestions collection"
12.Gateway新一代网关
建议收藏 | 在openGauss上遇到慢SQL该怎么办?
PHP string to binary conversion