Download the PHP package accredifysg/php-keccak-64bit without Composer

On this page you can find all versions of the php package accredifysg/php-keccak-64bit. 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 php-keccak-64bit

PHP-Keccak-64bit

Fast, dependency-free Keccak (224/256/384/512) and SHAKE (128/256) for 64-bit PHP.

It is a drop-in replacement for kornrunner/keccak that is roughly 5× faster on large inputs. Output is byte-for-byte identical to kornrunner for every fixed-length hash and for SHAKE up to the rate; for longer SHAKE output this package follows the NIST standard, where kornrunner does not (see Compatibility).

Note: this is the original (Ethereum-style, 0x01-suffixed) Keccak, the same variant implemented by kornrunner/keccak. It is not the NIST-finalised SHA-3 (which uses the 0x06 suffix). The SHAKE functions, however, are the NIST 0x1F-suffixed XOFs.

Why

When the native Keccak256 C extension is not installed, a pure-PHP Keccak dominates hashing time. Profiling a ~0.6 MB document, a single Keccak-256 call accounted for ~99% of processing time. This package keeps the 1600-bit state as 25 native 64-bit integers, unpacks the message once, and unrolls the permutation — for an end-to-end speed-up of ~5.6× over kornrunner/keccak:

Workload (PHP 8.5, no C extension, Xdebug off) kornrunner/keccak this package speed-up
Keccak-256 of 0.6 MB ~525 ms ~92 ms ~5.7×
End-to-end wrap of a 0.59 MB document ~540 ms ~97 ms ~5.6×

The whole message is unpacked into memory up front (that's where most of the speed-up comes from), so peak memory is a few times the input size. This is ideal for documents and other bounded payloads; for streaming or very large (hundreds-of-MB) inputs, a constant-memory hasher is a better fit.

Requirements

Installation

Usage

The API mirrors kornrunner/keccak, so it is a drop-in replacement.

API

Both methods return a lowercase hex string, or raw bytes when $binaryOutput is true.

Compatibility with kornrunner/keccak

The API and output match kornrunner/keccak exactly for:

For SHAKE output longer than the rate the two libraries diverge. kornrunner squeezes a single 200-byte state once and never re-permutes, so it cannot return more than 200 bytes and is non-conformant beyond the rate. This package implements the full NIST sponge squeeze, so its long SHAKE output matches the SHA-3 standard (verified against OpenSSL / Python hashlib). If you depend on kornrunner's exact byte stream past the rate, that output is not standard and is not reproduced here.

Output length: shake() requires $length to be a multiple of 8 bits and throws otherwise; kornrunner instead silently floors a non-multiple down to whole bytes. For byte-aligned lengths (the usual case) the two behave identically.

Correctness

Digests are verified to be byte-for-byte identical to kornrunner/keccak by the test suite: NIST/Ethereum known-answer vectors for every variant, cross-checks across rate-block boundaries for all four hash sizes and both SHAKE variants, the multi-block squeeze path, and a property test over random binary input.

License

MIT. See LICENSE.


All versions of php-keccak-64bit with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 accredifysg/php-keccak-64bit contains the following files

Loading the files please wait ...