https://github.com/beyondjs/crc32
A fast and efficient CRC32 (Cyclic Redundancy Check) implementation for Node.js and browser environments. This lightweight package offers optimized performance using a pre-computed lookup table, supporting both string and Buffer inputs. Ideal for projects requiring quick and reliable checksum calculations.
https://github.com/beyondjs/crc32
Last synced: 9 months ago
JSON representation
A fast and efficient CRC32 (Cyclic Redundancy Check) implementation for Node.js and browser environments. This lightweight package offers optimized performance using a pre-computed lookup table, supporting both string and Buffer inputs. Ideal for projects requiring quick and reliable checksum calculations.
- Host: GitHub
- URL: https://github.com/beyondjs/crc32
- Owner: beyondjs
- License: mit
- Created: 2022-12-01T13:27:55.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-08-07T22:32:01.000Z (11 months ago)
- Last Synced: 2025-09-08T21:59:29.664Z (9 months ago)
- Language: TypeScript
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @beyond-js/crc32
A fast and efficient CRC32 (Cyclic Redundancy Check) implementation for Node.js and browser environments.
## Installation
```bash
npm install @beyond-js/crc32
```
## Usage
```javascript
const crc32 = require('@beyond-js/crc32');
// Calculate CRC32 for a string
const result1 = crc32('Hello, World!');
console.log(result1); // Outputs a 32-bit unsigned integer
// Calculate CRC32 for a Buffer
const buffer = Buffer.from('Hello, World!', 'utf8');
const result2 = crc32(buffer);
console.log(result2); // Outputs the same 32-bit unsigned integer
```
## API
The module exports a single function:
```javascript
function crc32(input: string | Buffer): number
```
- `input`: The input data. Can be a string or a Buffer.
- Returns: A 32-bit unsigned integer representing the CRC32 checksum.
## Features
- Works with both strings and Buffers
- Optimized for performance using a pre-computed lookup table
- Compatible with Node.js and browser environments (when bundled)
## License
MIT © [[BeyondJS](https://beyondjs)]