PHPackages                             awesome/crc\_fast - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. awesome/crc\_fast

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

awesome/crc\_fast
=================

Fast SIMD hardware-accelerated CRC-32 and CRC-64 calculation capable of &gt;100GiB/s

1.1.0(6mo ago)6341Apache-2.0PHPPHP ^8.1CI passing

Since Nov 11Pushed 6mo ago4 watchersCompare

[ Source](https://github.com/awesomized/crc-fast-php-ext)[ Packagist](https://packagist.org/packages/awesome/crc_fast)[ Docs](https://github.com/awesomized/crc-fast-php-ext)[ RSS](/packages/awesome-crc-fast/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

`awesome/crc_fast`
==================

[](#awesomecrc_fast)

[![Tests status](https://github.com/awesomized/crc-fast-php-ext/workflows/Tests/badge.svg)](https://github.com/awesomized/crc-fast-php-ext/actions?query=workflow%3ATests)[![Latest Stable Version](https://camo.githubusercontent.com/cdee7eff6ae0f14246dd1cb8f6d598ac15da5c0b8f4a2fdaf8d1294fc07cb4c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617765736f6d652f6372635f66617374)](https://packagist.org/packages/awesome/crc_fast)

Fast, hardware-accelerated CRC calculation in `PHP` for [all known CRC-32 and CRC-64 variants](https://reveng.sourceforge.io/crc-catalogue/all.htm) using `SIMD`intrinsics, which can exceed *100GiB/s* for `CRC-32`, and *50GiB/s* for `CRC-64`, on modern systems.

It is much, much faster ([up to &gt;200X](#performance)) than the native [crc32](https://www.php.net/manual/en/function.crc32.php), `crc32b`, and `crc32c`[implementations](https://www.php.net/manual/en/function.hash-algos.php) in `PHP`, plus adds many more variants (particularly `CRC-64/NVME`).

The performance gains are especially pronounced on `aarch64` (Arm) systems, since PHP doesn't currently use hardware acceleration there.

CRC-64/NVME
-----------

[](#crc-64nvme)

[CRC-64/NVME](https://reveng.sourceforge.io/crc-catalogue/all.htm#crc.cat.crc-64-nvme) is in use in a variety of large-scale and mission-critical systems, software, and hardware, such as:

- The `AWS S3` [recommended checksum](https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html)
- The [Linux kernel](https://github.com/torvalds/linux/blob/786c8248dbd33a5a7a07f7c6e55a7bfc68d2ca48/lib/crc64.c#L66-L73)
- The [NVMe specification](https://nvmexpress.org/wp-content/uploads/NVM-Express-NVM-Command-Set-Specification-1.0d-2023.12.28-Ratified.pdf)

CRC-32/PHP, one of PHP's special flowers 🌼
------------------------------------------

[](#crc-32php-one-of-phps-special-flowers-)

`hash('crc32')` in `PHP` is not the same as `crc32()` in `PHP`, and doesn't match the `crc32` definition or output in many other programming languages and implementations (which is typically [CRC-32/ISO-HDLC](https://reveng.sourceforge.io/crc-catalogue/all.htm#crc.cat.crc-32-iso-hdlc))

Instead, it's actually [CRC-32/BZIP2](https://reveng.sourceforge.io/crc-catalogue/all.htm#crc.cat.crc-32-bzip2) which is then byte-reversed. This extension provides a `CrcFast\CRC_32_PHP` algorithm `const` that performs the same calculation, but accelerated.

```
$checksum = CrcFast\checksum(
    algorithm: CrcFast\CRC_32_PHP,
    string: '123456789'
); // 181989fc
```

Related SIMD-accelerated PHP extensions
---------------------------------------

[](#related-simd-accelerated-php-extensions)

- [simdutf](https://packagist.org/packages/awesome/simdutf) PHP extension for Unicode validation and transcoding at billions of characters per second using the [simdutf](https://github.com/simdutf/simdutf) project.
- [simdjson\_plus](https://packagist.org/packages/awesome/simdjson_plus) PHP extension for parsing gigabytes of JSON per second using the [simdjson](https://github.com/simdjson/simdjson) project.

Requirements
------------

[](#requirements)

Uses the [crc\_fast](https://github.com/awesomized/crc-fast-rust) `Rust` package and its `C`-compatible shared library under the hood, so you'll need to have built and installed it. (See [Usage](#Usage), below).

Changes
-------

[](#changes)

See the [change log](CHANGELOG.md).

Installing
----------

[](#installing)

Use [Composer](https://getcomposer.org) to install this library using [PIE](https://github.com/php/pie) (note the [Requirements](#Requirements) above):

```
composer install awesome/crc-fast
```

If you're using a non-standard installation location for the [crc\_fast](https://github.com/awesomized/crc-fast-rust)library, you may need to specify where the `crc_fast` header (in `include`) and shared library (in `lib`) can be found:

```
composer install awesome/crc-fast --with-crc-fast=/path/to/crc-fast
```

Building
--------

[](#building)

Like most `PHP` extensions, you can also build yourself:

```
phpize
./configure
make
```

or with a custom [crc\_fast](https://github.com/awesomized/crc-fast-rust) location where the `crc_fast` header and shared library can be found:

```
phpize
./configure --with-crc-fast=/path/to/crc-fast
make
```

Usage
-----

[](#usage)

Examples are for `CRC-64/NVME`, but you can use any [supported algorithm](#get-a-list-of-supported-algorithm-variants)variant.

### Calculate CRC-64/NVME checksums:

[](#calculate-crc-64nvme-checksums)

```
// calculate the checksum of a string
$checksum = CrcFast\hash(
    algorithm: CrcFast\CRC_64_NVME,
    string: '123456789'
); // ae8b14860a799888

// calculate the checksum of a file, which will chunk through the file optimally,
// limiting RAM usage and maximizing throughput
$checksum = CrcFast\hash_file(
    algorithm: CrcFast\CRC_64_NVME,
    filename: 'path/to/123456789.txt',
); // ae8b14860a799888
```

### Calculate CRC-64/NVME checksums with a Digest for intermittent / streaming / etc workloads:

[](#calculate-crc-64nvme-checksums-with-a-digest-for-intermittent--streaming--etc-workloads)

```
$crc64Digest = CrcFast\Digest::new(
    algorithm: CrcFast\CRC_64_NVME,
);

// write some data to the digest
$crc64Digest->write('1234');

// write some more data to the digest
$crc64Digest->write('56789');

// calculate the entire digest
$checksum = $crc64Digest->finalize(); // ae8b14860a799888
```

### Get a list of supported algorithm variants

[](#get-a-list-of-supported-algorithm-variants)

```
$algorithms = get_supported_algorithms();

var_dump($algorithms);
```

Equivalents to PHP functions
----------------------------

[](#equivalents-to-php-functions)

### crc32()

[](#crc32)

Calculates `CRC-32/ISO-HDLC` as an integer.

```
$checksum = CrcFast\crc32(
    data: '123456789'
); // 3421780262
```

### hash('crc32') 🌼

[](#hashcrc32-)

Calculates [CRC-32/PHP](#crc-32php-one-of-phps-special-flowers-) as binary or hex.

```
$checksum = CrcFast\hash(
    algorithm: CrcFast\CRC_32_PHP,
    string: '123456789'
    binary: false,
); // 181989fc
```

### hash('crc32b')

[](#hashcrc32b)

Calculates `CRC-32/ISO-HDLC` as binary or hex.

```
$checksum = CrcFast\hash(
    algorithm: CrcFast\CRC_32_ISO_HDLC,
    string: '123456789'
    binary: false,
); // cbf43926
```

### hash('crc32c')

[](#hashcrc32c)

Calculates `CRC-32/ISCSI` as binary or hex.

```
$checksum = CrcFast\hash(
    algorithm: CrcFast\CRC_32_ISCSI,
    string: '123456789'
    binary: false,
); // b798b438
```

IDE Stubs
---------

[](#ide-stubs)

This extension comes with IDE [stubs](crc_fast.stub.php) for use with your favorite development environment.

Tests
-----

[](#tests)

See the [tests](tests) directory for test coverage, which also double as useful examples.

```
make test
```

Platform support
----------------

[](#platform-support)

This extension has been extensively tested on `macOS` and `Linux`, on both `aarch64` and `x86_64`.

At [Awesome](https://awesome.co) we use it in production at very large scale on `Linux` on both [Flickr](https://flickr.com) and [SmugMug](https://smugmug.com).

This extension is not currently supported on `Windows`. :(

The underlying [crc\_fast](https://github.com/awesomized/crc-fast-rust) library (same authors) builds and works on `Windows`, so this is likely just a build issue with creating a working `config.w32` implementation. (I took a quick stab, failed, and moved on since we don't use `Windows` in production.)

If you want to help, please open a working PR. I'd love to merge it.

Performance
-----------

[](#performance)

`PHP` already uses `SIMD` intrinsics for `CRC-32` calculations on `x86_64` but not on `aarch64`. Even on `x86_64`, this library provides considerable improvements, in addition to supporting many more variants.

Tested using the maximum settings for [crc\_fast](https://github.com/awesomized/crc-fast-rust) for each platform, using 1MiB random payloads.

### CRC-32/ISCSI and CRC-32/ISO-HDLC

[](#crc-32iscsi-and-crc-32iso-hdlc)

ArchBrandCPUSystemPHPcrc\_fastSpeedupx86\_64IntelSapphire RapidsEC2 c7i.metal-48xl~27.0 GiB/s~108.1 GiB/s~4Xx86\_64AMDGenoaEC2 c7a.metal-48xl~13.6 GiB/s~53.7 GiB/s~4Xaarch64AWSGraviton4EC2 c8g.metal-48xl~0.4 GiB/s~52.3 GiB/s~141Xaarch64AppleM3 UltraMac Studio (32 core)~0.4 GiB/s~99.6 GiB/s~233X### CRC-32/PHP 🌼

[](#crc-32php-)

ArchBrandCPUSystemPHPcrc\_fastSpeedupx86\_64IntelSapphire RapidsEC2 c7i.metal-48xl~26.6 GiB/s~27.4 GiB/sn/ax86\_64AMDGenoaEC2 c7a.metal-48xl~13.6 GiB/s~25.4 GiB/s~2Xaarch64AWSGraviton4EC2 c8g.metal-48xl~0.4 GiB/s~31.5 GiB/s~73Xaarch64AppleM3 UltraMac Studio (32 core)~0.4 GiB/s~57.8 GiB/s~134X### CRC-64/NVME

[](#crc-64nvme-1)

Note that PHP has no native equivalent.

ArchBrandCPUSystemcrc\_fastx86\_64IntelSapphire RapidsEC2 c7i.metal-48xl~54.6 GiB/sx86\_64AMDGenoaEC2 c7a.metal-48xl~27.0 GiB/saarch64AWSGraviton4EC2 c8g.metal-48xl~37.0 GiB/saarch64AppleM3 UltraMac Studio (32 core)~70.0 GiB/sLicense
-------

[](#license)

`cfc-fast` is dual-licensed under

- Apache 2.0 license ([LICENSE-Apache](./LICENSE-Apache) or )
- MIT license ([LICENSE-MIT](./LICENSE-MIT) or )

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance69

Regular maintenance activity

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

181d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d0ecf1f0373c14a2206bd1797d2785caec54cee2b78ca0e6986275fb4a561684?d=identicon)[onethumb](/maintainers/onethumb)

---

Top Contributors

[![onethumb](https://avatars.githubusercontent.com/u/569776?v=4)](https://github.com/onethumb "onethumb (67 commits)")

---

Tags

checksumchecksum-calculationcrccrc32crc64extensionhardware-accelerationphpphp-extensionsimdchecksumcrc32crcsimdcrc64

### Embed Badge

![Health badge](/badges/awesome-crc-fast/health.svg)

```
[![Health](https://phpackages.com/badges/awesome-crc-fast/health.svg)](https://phpackages.com/packages/awesome-crc-fast)
```

###  Alternatives

[pburggraf/crc

Cyclic redundancy checker (crc) class to calculate crc8, crc16, crc24 and crc32 checksum values

18207.4k3](/packages/pburggraf-crc)[adigital/cookie-consent-banner

Add a configurable cookie consent banner to the website.

1150.7k](/packages/adigital-cookie-consent-banner)[michaels/data-manager

Simple data manager for nested data, dot notation array access, extendability, and container interoperability.

121.9k2](/packages/michaels-data-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
