Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@dikman/crc

dikman107MIT0.1.3TypeScript support: included

The library for calculating Cyclic Redundancy Check (CRC) for browser-side and nodejs-side

angular, crc24, crc32, checksum

readme

CRC

npm Downloads Monthly Downloads npm bundle size (minified + gzip) License

The library for calculating Cyclic Redundancy Check (CRC) for browser-side. The calculation is table-based. Tables are dynamically generated once per each CRC function.

This library is an adaptation and simplification of polycrc for use it on browser-side. CRC mathematics is checked with pycrc. It seems to be no other module in npm registry wich possible to use with Angular framework.

Even though this library was designed for browser-side it also keeps the possibility to use on nodejs-side.

Contents

Installation

npm install @dikman/crc

API

function crc24(str: string): Converter;
function crc32(str: string): Converter;
interface Converter {
  public toHEX(prefix: string = '0x'): string;
  public asNumber(): number;
}

Usage

Calculate a CRC32

import { crc32 } from '@dikman/crc';

const checksum = crc32('hello');

console.log(checksum.toHEX());
// "0x3610A686"

console.log(checksum.asNumber());
// 907060870

Calculate a CRC24

import { crc24 } from '@dikman/crc';

const checksum = crc24('hello');

console.log(checksum.toHEX());
// "0x47F58A"

console.log(checksum.asNumber());
// 4715914

License

The MIT License (MIT)

Copyright (c) 2020 Dmitriy Kuznetsov

Generated

This library was generated with Angular CLI version 8.2.14.

changelog

0.1.3

Features

  • fixed link to the homepage in README.md

0.1.2

Features

  • improved test coverage up to 100%

0.1.1

Features

  • improved README.md

0.1.0

Features

  • made CRC library supports crc24 and crc32 functions