{"id":16148913,"url":"https://github.com/erriez/erriezcrc32","last_synced_at":"2025-10-16T11:32:30.795Z","repository":{"id":85067597,"uuid":"147911993","full_name":"Erriez/ErriezCRC32","owner":"Erriez","description":"Target independent, flash and RAM size optimized CRC32 library for Arduino without CRC tables.","archived":false,"fork":false,"pushed_at":"2020-08-28T16:02:08.000Z","size":697,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T23:15:59.053Z","etag":null,"topics":["arduino","benchmarks","crc32","documentation","esp32","esp8266","examples","library","multi-target","small-footprint","unittests","uno"],"latest_commit_sha":null,"homepage":"https://github.com/Erriez/ErriezArduinoLibrariesAndSketches","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Erriez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-09-08T07:29:33.000Z","updated_at":"2024-05-25T20:31:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"1ea8c1c7-3ee4-412f-a939-8290bdbfe17c","html_url":"https://github.com/Erriez/ErriezCRC32","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Erriez/ErriezCRC32","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erriez%2FErriezCRC32","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erriez%2FErriezCRC32/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erriez%2FErriezCRC32/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erriez%2FErriezCRC32/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Erriez","download_url":"https://codeload.github.com/Erriez/ErriezCRC32/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erriez%2FErriezCRC32/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279183737,"owners_count":26121465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-16T02:00:06.019Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","benchmarks","crc32","documentation","esp32","esp8266","examples","library","multi-target","small-footprint","unittests","uno"],"created_at":"2024-10-10T00:35:14.631Z","updated_at":"2025-10-16T11:32:30.789Z","avatar_url":"https://github.com/Erriez.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Optimized CRC32 library for Arduino\n[![Build Status](https://travis-ci.org/Erriez/ErriezCRC32.svg?branch=master)](https://travis-ci.org/Erriez/ErriezCRC32)\n\nThis is a target independent, flash and RAM size optimized CRC32 library for Arduino without CRC tables.\n\n![CRC32](https://raw.githubusercontent.com/Erriez/ErriezCRC32/master/extras/CRC32.png)\n\n\n## Library features\n\n- Compatible with standard CRC32 algorithms\n- Small flash footprint\n- No RAM buffer allocations\n- 32-bit table-less CRC32 calculation on:\n  - Arduino String object\n  - Single null-terminated character array\n  - Single buffer\n  - Multiple null-terminated character arrays\n  - Multiple buffers\n- No buffer alignment needed\n- Buffer input length in Bytes\n- Big and little endian input buffers\n- Arduino C library, compatible with C and C++ applications\n- CRC32 polynomial: 0xEDB88320\n\n\n## Hardware\n\nThis library can be used on any 8 or 32-bit target and is optimized for small flash/RAM footprints\nwithout CRC table allocations in RAM.\n\n\n## Examples and benchmarks\n\nArduino IDE | Examples | Erriez CRC32:\n\n* [ErriezCRC32](https://github.com/Erriez/ErriezCRC32/blob/master/examples/ErriezCRC32/ErriezCRC32.ino)\n* [ErriezCRC32Benchmark](https://github.com/Erriez/ErriezCRC32/blob/master/examples/ErriezCRC32Benchmark/ErriezCRC32Benchmark.ino)\n\n\n#### Benchmark results on buffers\n\nThe benchmark results below may be different for each target and run. Lower duration means faster CRC calculation.\n\n| Board                       | F_CPU  | 4 Bytes | 64 Bytes | 512 Bytes | 1024 Bytes |\n| --------------------------- | :----: | :-----: | :------: | :-------: | :--------: |\n| Arduino UNO (ATMega328)     | 16MHz  |  80us   |  1172us  |  9000us   |  17112us   |\n| ESP8266 (WeMOS D1 R2)       | 160MHz |   3us   |   35us   |   279us   |   557us    |\n| ESP32 (WeMOS Lolin32)       | 80MHz  |   2us   |   15us   |   111us   |   223us    |\n| DUE (SAM3X8E ARM Cortex-M3) | 84MHz  |   6us   |   70us   |   547us   |   1103us   |\n\nBenchmarks performed with the following versions:\n\n* Arduino IDE v1.8.5\n* Arduino AVR Boards v1.6.21 (Arduino UNO)\n* [esp8266](http://arduino.esp8266.com/stable/package_esp8266com_index.json) v2.4.2\n* Arduino SAM Boards (32-bits ARM Cortex-M3) v1.6.11\n\n## Unit tests\n\nThis library contains extensive unit tests on a various number of buffer types and lengths:\n\n* [ErriezCRC32UnitTest](https://github.com/Erriez/ErriezCRC32/blob/master/examples/ErriezCRC32UnitTest/ErriezCRC32UnitTest.ino)\n\n\n## Library documentation\n\n* [Doxygen online HTML](https://erriez.github.io/ErriezCRC32)\n* [Doxygen PDF](https://raw.githubusercontent.com/Erriez/ErriezCRC32/master/ErriezCRC32.pdf)\n\n\n## Usage\n\n**Introduction**\n\nThe library consists of four C-functions for CRC calculation:\n\n```c++\n// Calculate CRC32 on null-terminated character array (string)\nuint32_t crc32String(const char *buffer);\n// Calculate CRC32 on one single buffer\nuint32_t crc32Buffer(const void *buffer, size_t bufferLength);\n\n// Calculate CRC32 on multiple buffers\n// First crc32Update() call should start with argument crc = CRC32_INITIAL\n// Next crc32Update() calls should set argument crc = previousCRC\nuint32_t crc32Update(const void *buffer, size_t bufferLength, uint32_t crc);\n// Call crc32Update() at the end after the last crc32Update()\nuint32_t crc32Final(uint32_t crc);\n```\n\n**Initialization**\n\nOnly an include file is required. No object allocation or library initialization required.\n\n```c++\n#include \u003cErriezCRC32.h\u003e\n```\n\n**Calculate CRC32 on Arduino String**\n\n```c++\nString msg = \"Hello world String!\";\nuint32_t crc = crc32String(msg.c_str());\n```\n\n**Calculate CRC32 on null-terminated character array**\n\n```c++\nchar msg[] = \"Hello world char array!\";\nuint32_t crc = crc32String(msg);\n```\n\n**Calculate CRC32 on single character buffer**\n\n```c++\nchar msg[] = \"Hello world single buffer!\";\nuint32_t crc = crc32Buffer(msg, strlen(msg));\n```\n\n**Calculate CRC32 on multiple characters**\n\n```c++\nuint32_t crc;\n\ncrc = crc32Update(\"Hello \", 6, CRC32_INITIAL);\ncrc = crc32Update(\"world \", 6, crc);\ncrc = crc32Update(\"multiple \", 9, crc);\ncrc = crc32Update(\"buffers!\", 8, crc);\ncrc = crc32Final(crc);\n```\n\n**Calculate CRC32 on multiple buffers**\n\n```c++\nconst uint8_t testBuffer1[3] = { 0xEB, 0xE5, 0x51 };\nconst uint8_t testBuffer2[5] = { 0x87, 0x7F, 0xB8, 0x18, 0x4E };\nuint32_t crc;\n\ncrc = crc32Update(testBuffer1, sizeof(testBuffer1), CRC32_INITIAL);\ncrc = crc32Update(testBuffer2, sizeof(testBuffer2), crc);\ncrc = crc32Final(crc);\n```\n\n**Check CRC**\n\n```c++\nvoid checkCRC(uint32_t crcCalculated, uint32_t crcExpected)\n{\n    printCRC(crcCalculated);\n    Serial.print(F(\"...\"));\n\n    if (crcCalculated == crcExpected) {\n        Serial.println(F(\"OK\"));\n    } else {\n        Serial.print(F(\"FAILED! Expected: \"));\n        printCRC(crcExpected);\n        Serial.println(F(\"\"));\n    }\n}\n```\n\n**Print 32-bit CRC value**\n\nPrinting a ```uint32_t``` value is not implemented on some targets which is a limitation of ```Serial.print()``` or ```sprintf()```. \nThis is a workaround to print a 32-bit hex value:\n\n```c++\nvoid printCRC(uint32_t crc)\n{\n\tSerial.print(\"0x\");\n    for (int8_t i = 3; i \u003e= 0; i--) {\n        uint8_t c = crc \u003e\u003e (i * 8);\n        if (c \u003c 0x10) {\n            Serial.print(\"0\");\n        }\n        Serial.print(c, HEX);\n    }\n}\n```\n\n**CRC-calculation with Python**\n\n```python\n\u003e\u003e\u003e import binascii\n\u003e\u003e\u003e hex(binascii.crc32(b'Hello world String!') \u0026 0xffffffff)\n'0x55df869b'\n```\n\n\n\n## Library dependencies\n\n* ErriezCRC32Benchmark.ino: [ErriezTimestamp.h](https://github.com/Erriez/ErriezTimestamp.git)\n* ErriezCRC32UnitTest.ino: [ArduinoUnit.h](https://github.com/mmurdoch/arduinounit)\n\n\n## Library installation\n\nPlease refer to the [Wiki](https://github.com/Erriez/ErriezArduinoLibrariesAndSketches/wiki) page.\n\n\n## Other Arduino Libraries and Sketches from Erriez\n\n* [Erriez Libraries and Sketches](https://github.com/Erriez/ErriezArduinoLibrariesAndSketches)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferriez%2Ferriezcrc32","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferriez%2Ferriezcrc32","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferriez%2Ferriezcrc32/lists"}