当前位置:网站首页>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
边栏推荐
- 大佬们 有没有搞过sink分流写入clickhouse 或者其他数据库的操作。
- 7-Zip 遭抵制?呼吁者定下“三宗罪”:伪开源、不安全、作者来自俄罗斯!
- 历史上的今天:九十年代末的半导体大战;冯·诺依曼发表第一份草案;CBS 收购 CNET...
- 硬件中台项目
- SQL server2014 failed to delete the database, with an error offset of 0x0000
- 日本教授起诉英特尔FPGA与SoC产品侵犯一项设计专利
- Comparison between Oracle JDK and openjdk
- Floyd repeat
- How did the data center change from "Britney Spears" to "Mrs. cow"?
- php 实现抽奖功能
猜你喜欢

Venv: directory structure of venv

TC8:UDP_ USER_ INTERFACE_ 01-08

CCNP Part XII BGP (IV)

The latest masterpiece of Alibaba, which took 182 days to produce 1015 pages of distributed full stack manual, is so delicious

In the new database era, don't just learn Oracle and MySQL

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

CodeBlocks 左侧项目栏消失,workspace 自动保存项目,Default workspace,打开上次的workspace,工作区(图文教程,已解决)

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;

全球基金和资管的股票建仓率达到15年内新低

建议收藏 | 在openGauss上遇到慢SQL该怎么办?
随机推荐
零基础入行软件测试必看,10年测试老鸟的良心建议(共15条)
Module 9: design e-commerce seckill system
怎么理解JS Promise
Daily mathematics serial 55: February 24
Ubuntu系统安装与配置MySQL
Is it safe to buy funds on the access letter?
Ssh server rejects password, try again; Permitrootlogin yes invalid problem
京东与腾讯续签三年战略合作协议;起薪涨至26万元!韩国三星SK争相加薪留住半导体人才;Firefox 102 发布|极客头条...
新数据库时代,不要只学 Oracle、MySQL
CSDN's one-stop cloud service is open for internal testing, and new and old users are sincerely invited to grab the fresh
Raspberry pie 4B system construction (ultra detailed version)
线程基础知识
Drive away bad emotions and stop worrying
全球基金和资管的股票建仓率达到15年内新低
BSN长话短说之十:如何保证NFT的安全
Button button clear border
Does anyone know the logic of limit statement execution in Clickhouse? In the picture, the SQL above can be executed successfully
谁还在买“三只松鼠”们
有大佬知道这是为啥吗?表结构都是刚直接复制的源表 mysql-cdc
在通达信上买基金安全吗?