Socket
Socket
Sign inDemoInstall

@aws-crypto/crc32c

Package Overview
Dependencies
5
Maintainers
8
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @aws-crypto/crc32c

Pure JS implementation of CRC32-C https://en.wikipedia.org/wiki/Cyclic_redundancy_check


Version published
Maintainers
8
Install size
627 kB
Created

Package description

What is @aws-crypto/crc32c?

The @aws-crypto/crc32c package is designed for calculating CRC32C (Cyclic Redundancy Check) checksums. This is particularly useful for verifying the integrity of data, such as files or network packets, to ensure they have not been altered during transmission or storage. The CRC32C algorithm is known for its efficiency and error-detection capabilities, making it a popular choice for error-checking applications.

What are @aws-crypto/crc32c's main functionalities?

Calculate CRC32C checksum from a string

This feature allows you to calculate the CRC32C checksum of a given string. The input string is first converted to a Buffer, and then the `crc32c` function is used to calculate the checksum. The result is a number that represents the checksum, which can be converted to a hexadecimal string for easier reading or comparison.

"use strict";
const { crc32c } = require('@aws-crypto/crc32c');

const input = Buffer.from('Hello World');
const checksum = crc32c(input);
console.log(`CRC32C Checksum: ${checksum.toString(16)}`);

Calculate CRC32C checksum from a file

This feature demonstrates how to calculate the CRC32C checksum of a file. The file is read into a Buffer using Node.js's `fs.readFileSync` method, and then the `crc32c` function is applied to this Buffer to compute the checksum. This is useful for verifying the integrity of files.

"use strict";
const fs = require('fs');
const { crc32c } = require('@aws-crypto/crc32c');

const fileBuffer = fs.readFileSync('path/to/your/file.txt');
const checksum = crc32c(fileBuffer);
console.log(`CRC32C Checksum of the file: ${checksum.toString(16)}`);

Other packages similar to @aws-crypto/crc32c

Changelog

Source

3.0.0 (2023-01-12)

Bug Fixes

  • docs: sha256 packages, clarify hmac support (#455) (1be5043)

  • feat!: replace Hash implementations with Checksum interface (#492) (da43dc0), closes #492

BREAKING CHANGES

  • All classes that implemented Hash now implement Checksum.

Readme

Source

@aws-crypto/crc32c

Pure JS implementation of CRC32-C https://en.wikipedia.org/wiki/Cyclic_redundancy_check

Usage

import { Crc32c } from '@aws-crypto/crc32c';

const crc32Digest = (new Crc32c).update(buffer).digest()

Test

npm test

FAQs

Last updated on 12 Jan 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc