npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ts-crc32

v1.0.0

Published

A direct TypeScript port of a tiny CRC-32 (IEEE 802.3) reference. Zero dependencies, matches zlib/gzip/PNG/Python binascii.

Readme

ts-crc32

A direct TypeScript port of a tiny CRC-32 (IEEE 802.3) reference implementation.

If you find this project useful, you can support this and further ports at ko-fi.com/scottmoore0.

Upstream provenance

This package is a TypeScript port of aeldidi/crc32 (crc32.c, crc32.h) by Ayman El Didi, released under CC0 1.0 (public domain dedication).

The translated output is validated against canonical CRC-32 reference values, including the well-known check value CRC32("123456789") == 0xCBF43926.

Why this exists

CRC-32 with polynomial 0xEDB88320 is the most-deployed integrity checksum in the world — used inside zlib/gzip, PNG, ZIP archives, Ethernet frames, SCTP, MPEG-2 Transport Stream, JPEG, and the crc32 built-ins of Python (binascii.crc32), Go (hash/crc32 IEEE table), Java (java.util.zip.CRC32), Ruby (Zlib.crc32), Rust (crc32fast), and many others.

ts-crc32 is a direct mechanical translation from a tiny CC0 C reference via the cpp-to-ts translator, so its relationship to the algorithm is inspectable.

Install

npm install ts-crc32

Usage

import { crc32sum, crc32hex } from 'ts-crc32';

// Numeric (uint32)
crc32sum('123456789');             // 3421780262 (= 0xCBF43926)

// Hex string
crc32hex('123456789');             // 'cbf43926'

// Raw bytes
crc32hex(new Uint8Array([0xde, 0xad, 0xbe, 0xef]));

Strings are encoded as UTF-8 before hashing.

API surface

  • crc32sum(input: Uint8Array | string): number — returns an unsigned 32-bit integer.
  • crc32hex(input: Uint8Array | string): string — returns an 8-character lowercase hex string.

Reference values

The test suite asserts against:

| Input | CRC-32 | |---|---| | "" | 00000000 | | "a" | e8b7be43 | | "abc" | 352441c2 | | "message digest" | 20159d7f | | "abcdefghijklmnopqrstuvwxyz" | 4c2750bd | | "123456789" (canonical check value) | cbf43926 | | "The quick brown fox jumps over the lazy dog" | 414fa339 |

Run:

npm test

Caveats

  • Not cryptographic. CRC-32 is a non-cryptographic integrity check, easily forgeable. Use SHA-256 (ts-sha2) when adversaries are in the threat model.
  • Algorithm variant. This is the standard "IEEE 802.3" reflected CRC-32 with polynomial 0xEDB88320. If you need CRC-32C (Castagnoli, polynomial 0x82F63B78, used in iSCSI/SCTP/Btrfs/Ceph), this is the wrong package.
  • Performance. Direct port of a byte-at-a-time reference. For high-throughput needs prefer Node's built-in crypto.createHash('sha256') for integrity or a slice-by-16 native implementation for raw CRC.

License

CC0 1.0 (public domain). Original C by Ayman El Didi.

See also

  • ts-sha2 — SHA-256 for cryptographic integrity
  • ts-xxhash — much faster non-cryptographic hash
  • ts-fnv-hash — alternative non-cryptographic hash
  • cpp-to-ts — the translator that produced this package