https://github.com/oagoulart/libluacrc32
Lua 5.5 library to generate 32-bits cyclic redundancy checks.
https://github.com/oagoulart/libluacrc32
crc32 iso13239 lua lua-library sse42
Last synced: 16 days ago
JSON representation
Lua 5.5 library to generate 32-bits cyclic redundancy checks.
- Host: GitHub
- URL: https://github.com/oagoulart/libluacrc32
- Owner: oAGoulart
- License: ms-rl
- Created: 2025-07-23T22:51:55.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-12-29T14:27:42.000Z (5 months ago)
- Last Synced: 2026-01-01T17:46:44.039Z (5 months ago)
- Topics: crc32, iso13239, lua, lua-library, sse42
- Language: C
- Homepage:
- Size: 74.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# libluacrc32
[](https://www.iso.org/standard/37010.html)
[](https://github.com/oAGoulart/libluacrc32/releases)
[](https://github.com/oAGoulart/libluacrc32/tree/master?tab=MS-RL-1-ov-file)
[](https://www.lua.org/download.html)
Lua 5.5 library to generate 32-bits cyclic redundancy checks. Code includes four pre-generated lookup tables for six different methods.
**Methods available:**
1. ISO-HDLC (default; tested @ max. ~0.35 GB/s*)
1. ISCSI (with SSE 4.2; tested @ max. ~5.3 GB/s*)
1. JAMCRC
1. MPEG-2
1. BZIP2
1. CD-ROM-EDC
\* _NOTE:_ preliminary tests performed only, further systematic tests required.
## Usage
Binaries for AMD64 are available on [Releases](https://github.com/oAGoulart/libluacrc32/releases) page. For x86, compile with gcc or use `build.sh` script. If on Windows, use MinGW/MSYS2 with `CFLAGS` and `LFLAGS` set to include and library paths, respectively.
```sh
env CFLAGS=-IC:/msys64/usr/local/include \
LFLAGS=-LC:/msys64/usr/local/bin ./build.sh
```
**NOTE:** If you want to use MSVC, you are on your own, sorry.
Then, require and call with a string to calculate its CRC. First and second arguments of `calculate` are `strings`, the latter is which method to use.
```lua
local crc32 = require("libluacrc32")
print(crc32.calculate("wrappem", "ISCSI"))
-- output: 969553473
```
**NOTE:** If the Lua code above fails with `module 'libluacrc32' not found` on Windows, add `package.cpath=".\\?.dll"` one line before `require` or change your `LUA_CPATH` environment variable to include `.\\?.dll`.
## Further reading
1. [Catalogue of parametrised CRC algorithms with 17 or more bits](https://reveng.sourceforge.io/crc-catalogue/17plus.htm).