Download the PHP package awesome/crc_fast without Composer

On this page you can find all versions of the php package awesome/crc_fast. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package crc_fast

awesome/crc_fast

Tests status Latest Stable Version

Fast, hardware-accelerated CRC calculation in PHP for all known CRC-32 and CRC-64 variants 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 (crc32, crc32b, and crc32c implementations 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-64/NVME is in use in a variety of large-scale and mission-critical systems, software, and hardware, such as:

CRC-32/PHP, one of PHP's 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)

Instead, it's actually 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.

Related SIMD-accelerated PHP extensions

Requirements

Uses the crc_fast Rust package and its C-compatible shared library under the hood, so you'll need to have built and installed it. (See Usage, below).

Changes

See the change log.

Installing

Use Composer to install this library using PIE (note the Requirements above):

If you're using a non-standard installation location for the crc_fast library, you may need to specify where the crc_fast header (in include) and shared library (in lib) can be found:

Building

Like most PHP extensions, you can also build yourself:

or with a custom crc_fast location where the crc_fast header and shared library can be found:

Usage

Examples are for CRC-64/NVME, but you can use any supported algorithm variant.

Calculate CRC-64/NVME checksums:

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

Get a list of supported algorithm variants

Equivalents to PHP functions

crc32()

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

hash('crc32') 🌼

Calculates CRC-32/PHP as binary or hex.

hash('crc32b')

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

hash('crc32c')

Calculates CRC-32/ISCSI as binary or hex.

IDE Stubs

This extension comes with IDE stubs for use with your favorite development environment.

Tests

See the tests directory for test coverage, which also double as useful examples.

Platform support

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

At Awesome we use it in production at very large scale on Linux on both Flickr and SmugMug.

This extension is not currently supported on Windows. :(

The underlying crc_fast 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

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 for each platform, using 1MiB random payloads.

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

Arch Brand CPU System PHP crc_fast Speedup
x86_64 Intel Sapphire Rapids EC2 c7i.metal-48xl ~27.0 GiB/s ~108.1 GiB/s ~4X
x86_64 AMD Genoa EC2 c7a.metal-48xl ~13.6 GiB/s ~53.7 GiB/s ~4X
aarch64 AWS Graviton4 EC2 c8g.metal-48xl ~0.4 GiB/s ~52.3 GiB/s ~141X
aarch64 Apple M3 Ultra Mac Studio (32 core) ~0.4 GiB/s ~99.6 GiB/s ~233X

CRC-32/PHP 🌼

Arch Brand CPU System PHP crc_fast Speedup
x86_64 Intel Sapphire Rapids EC2 c7i.metal-48xl ~26.6 GiB/s ~27.4 GiB/s n/a
x86_64 AMD Genoa EC2 c7a.metal-48xl ~13.6 GiB/s ~25.4 GiB/s ~2X
aarch64 AWS Graviton4 EC2 c8g.metal-48xl ~0.4 GiB/s ~31.5 GiB/s ~73X
aarch64 Apple M3 Ultra Mac Studio (32 core) ~0.4 GiB/s ~57.8 GiB/s ~134X

CRC-64/NVME

Note that PHP has no native equivalent.

Arch Brand CPU System crc_fast
x86_64 Intel Sapphire Rapids EC2 c7i.metal-48xl ~54.6 GiB/s
x86_64 AMD Genoa EC2 c7a.metal-48xl ~27.0 GiB/s
aarch64 AWS Graviton4 EC2 c8g.metal-48xl ~37.0 GiB/s
aarch64 Apple M3 Ultra Mac Studio (32 core) ~70.0 GiB/s

License

cfc-fast is dual-licensed under


All versions of crc_fast with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package awesome/crc_fast contains the following files

Loading the files please wait ...