当前位置:网站首页>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
边栏推荐
- 项目必用的全局异常处理器,你学会了吗
- 怎么理解JS Promise
- venv: venv 的目录结构
- Apple amplification! It's done so well
- Po mode deep encapsulation
- Centos 配置discuz 提示请检查 mysql 模块是否正确加载
- [laravel] detailed explanation of faker data filling
- Win11账号被锁定无法登录怎么办?Win11账号被锁定无法登录
- Raspberry pie 4B system construction (ultra detailed version)
- About database: how to avoid deadlock in gbase 8s
猜你喜欢

推荐一款 JSON 可视化工具神器!

Introduction of uniapp wechat applet components on demand

bash: ln: command not found
![C [byte array] and [hexadecimal string] mutual conversion - codeplus series](/img/d2/dad88f53701c7cd7638bd4983cbb4b.png)
C [byte array] and [hexadecimal string] mutual conversion - codeplus series

数据库的增删改查问题

It is interesting to understand MMAP in this way!

渗透常用工具-Goby

12. Gateway new generation gateway

Kotlin 协程调度切换线程是时候解开真相了

数字藏品市场新局面
随机推荐
日本教授起诉英特尔FPGA与SoC产品侵犯一项设计专利
PHP string to binary conversion
线程基础知识
新一代云原生数据库的设计与实践
Module 9: design e-commerce seckill system
SQL statement modify field type "suggestions collection"
PHP 字符串与二进制相互转换
Hardware midrange project
The "China Mobile Chain" state secret engine was officially launched on BSN
IDEA运行报错Command line is too long. Shorten command line for...
大佬们 有没有搞过sink分流写入clickhouse 或者其他数据库的操作。
历史上的今天:九十年代末的半导体大战;冯·诺依曼发表第一份草案;CBS 收购 CNET...
Postgraduate entrance examination vocabulary 2023 sharing (1)
How do clients request databases?
What a high commission! The new programmer's partner plan is coming. Everyone can participate!
CCNP Part XII BGP (IV)
Dotnet console uses microsoft Maui. Getting started with graphics and skia
Thread Basics
Kotlin coprocessor scheduling switch threads it's time to unravel the truth
Centos 配置discuz 提示请检查 mysql 模块是否正确加载