当前位置:网站首页>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
边栏推荐
- PHP 字符串与二进制相互转换
- Po mode deep encapsulation
- Is it safe to do fund fixed investment on CICC securities?
- How do clients request databases?
- Dotnet console uses microsoft Maui. Getting started with graphics and skia
- Prefabricated dishes usher in the "golden age", who can lead the next trillion market
- tryhackme圣诞挑战2021-Advent of Cyber 3-day1-IDOR漏洞,不安全的访问控制漏洞
- 大佬们,数据湖iceberg的数据,怎样导出到mysql? 有什么工具? sqoop,datax都没
- Thread Basics
- Configure load balancing
猜你喜欢

The stock position building rate of global funds and asset management reached a new low in 15 years

Module 9: design e-commerce seckill system

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

好高的佣金,《新程序员》合伙人计划来袭,人人皆可参与!

PHP code audit and File Inclusion Vulnerability

IDEA运行报错Command line is too long. Shorten command line for...

硬件中台项目

持续进阶,软通动力稳步推动云智能战略

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

这样理解mmap,挺有意思!
随机推荐
4hutool实战:DateUtil-格式化时间[通俗易懂]
数字藏品平台搭建需要注意哪些法律风险及资质?
MySQL常用命令
程序员都想去国企?技术落后薪资低,躺平几年出来都找不到工作...
【Laravel 】faker数据填充详解
Ubuntu system installation and MySQL configuration
Sleeping second brother...
What a high commission! The new programmer's partner plan is coming. Everyone can participate!
有大佬知道这是为啥吗?表结构都是刚直接复制的源表 mysql-cdc
CCNP Part XII BGP (IV)
leetcode:111. 二叉树的最小深度
Ubuntu系统安装与配置MySQL
sql语句修改字段类型「建议收藏」
CodeBlocks 左侧项目栏消失,workspace 自动保存项目,Default workspace,打开上次的workspace,工作区(图文教程,已解决)
北汽蓝谷:业绩承压,极狐难期
I like two men...
Have you learned the necessary global exception handler for the project
这样理解mmap,挺有意思!
Dotnet console uses microsoft Maui. Getting started with graphics and skia
Prefabricated dishes usher in the "golden age", who can lead the next trillion market