🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@balena/node-crc-utils

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@balena/node-crc-utils

CRC Utils. Combines two or more CRC32 checksums into new one.

3.0.1
latest
Source
npm
Version published
Weekly downloads
4.1K
1.35%
Maintainers
3
Weekly downloads
 
Created
Source

Node CRC32 Utils

Combines two or more CRC32 checksums into new one.

##How to install:

npm install @balena/node-crc-utils

##How to build:

Install emscripten, clone this repo then

npm run build

##Example:

const crcUtils = require('@balena/node-crc-utils');

// for crc32 checksum use lib: https://github.com/brianloveswords/buffer-crc32/
const crc32 = require('buffer-crc32');

const foo = Buffer.from('foo');
const bar = Buffer.from('bar');

const fooCrc32 = crc32(foo); // <Buffer 8c 73 65 21>
const barCrc32 = crc32(bar); // <Buffer 76 ff 8c aa>
 
const foobar = Buffer.from('foobar');
const foobarCrc32 = crc32(foobar);

crcUtils.ready.then(() => {
	const foobarCrc32Combined = crcUtils.crc32_combine(
		fooCrc32.readUInt32BE(0), 
		barCrc32.readUInt32BE(0), 
		bar.length
	); 

	// CRC32 are the same but Endianness is prepared for GZIP format
	console.log(foobarCrc32);         // <Buffer 9e f6 1f 95>
	console.log(foobarCrc32Combined); // <Buffer 95 1f f6 9e>
});

Keywords

crc32

FAQs

Package last updated on 19 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts