PHPackages                             amashukov/keccak-php - 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. [Security](/categories/security)
4. /
5. amashukov/keccak-php

ActiveLibrary[Security](/categories/security)

amashukov/keccak-php
====================

Keccak-256 and SHA-3 family permutations in pure PHP.

v0.1.2(2mo ago)0378↑43.6%3MITPHPPHP &gt;=8.3CI passing

Since May 24Pushed 2mo agoCompare

[ Source](https://github.com/AndreyMashukov/keccak-php)[ Packagist](https://packagist.org/packages/amashukov/keccak-php)[ RSS](/packages/amashukov-keccak-php/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (5)Versions (4)Used By (3)

amashukov/keccak-php
====================

[](#amashukovkeccak-php)

Pure-PHP Keccak-256, SHA-3 and SHAKE hashing — the `keccak256` primitive behind Ethereum addresses, ABI selectors and EVM signatures.

[![CI](https://camo.githubusercontent.com/a07e7b96ccccd1d9be142c7eb24c30f608f2630753c0dbaa78e1127f129243e8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e647265794d617368756b6f762f6b656363616b2d7068702f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349)](https://github.com/AndreyMashukov/keccak-php/actions)[![PHPStan L9](https://camo.githubusercontent.com/7cd5a681c0218e774711870f96509cb33834cd5814a3363c31728048fee612f3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e647265794d617368756b6f762f6b656363616b2d7068702f7374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d5048505374616e2532304c39)](https://github.com/AndreyMashukov/keccak-php/actions)[![Latest Version](https://camo.githubusercontent.com/75912ad76e5ab1772ca36c8361c0467954f43db86530811b6196ddc670bf7cc1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d617368756b6f762f6b656363616b2d706870)](https://packagist.org/packages/amashukov/keccak-php)[![Downloads](https://camo.githubusercontent.com/6ff464de3fc906e23d529618ef23c5d5571a3f989560b5b88c2182ceedbe576b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d617368756b6f762f6b656363616b2d706870)](https://packagist.org/packages/amashukov/keccak-php)[![PHP](https://camo.githubusercontent.com/fc4eb472e8354ab1d085a1c80b0b30bae15aaa7d9a68c6a77c04ec41a456e94f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f616d617368756b6f762f6b656363616b2d7068702f706870)](https://packagist.org/packages/amashukov/keccak-php)[![License](https://camo.githubusercontent.com/3873283a98bf564d3a248d7f3a15811cdddb66ecb949e86105b154b673369c05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616d617368756b6f762f6b656363616b2d706870)](LICENSE)[![Stars](https://camo.githubusercontent.com/28964cd54e87299882c8d81fca54901022183865b6d7c7f11f4590ed3cb29b50/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f416e647265794d617368756b6f762f6b656363616b2d7068703f7374796c653d736f6369616c)](https://github.com/AndreyMashukov/keccak-php)

`amashukov/keccak-php` is a pure-PHP implementation of the Keccak / SHA-3 family of cryptographic hash functions, including the SHAKE extendable-output functions (XOF). It provides the `keccak256` hash primitive used across Ethereum and other modern blockchains for address derivation, ABI function selectors and EIP-191 / EIP-712 message signing. Zero composer dependencies — only `ext-mbstring` from PHP core.

Features
--------

[](#features)

- **Keccak-256** — the exact hash Ethereum uses for `keccak256`, address derivation and ABI selectors.
- **Full SHA-3 family** — output sizes `224`, `256`, `384`, `512`.
- **SHAKE128 / SHAKE256** extendable-output functions with arbitrary output length.
- **Hex or raw binary** output via a single `raw_output` flag.
- **Pure PHP** — no native extension to compile, no FFI; runs anywhere PHP 8.3 runs.
- **Zero composer dependencies** — `ext-mbstring` only.
- PHPStan level 9 clean, `@PER-CS` formatted, CI-tested.

Installation
------------

[](#installation)

```
composer require amashukov/keccak-php
```

Usage
-----

[](#usage)

```
use Amashukov\Keccak\Keccak;

// Hex-encoded hash output (default).
$digest = Keccak::hash('hello world', 256);
// → 47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad

// Raw 32-byte binary output.
$raw = Keccak::hash('hello world', 256, raw_output: true);
```

Supported output sizes: `224`, `256`, `384`, `512`. SHAKE variants:

```
$xof = Keccak::shake('hello world', security_level: 128, outlen: 256);
```

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

[](#requirements)

- PHP 8.3+
- `ext-mbstring`

No composer dependencies.

Related packages
----------------

[](#related-packages)

Part of a modular pure-PHP blockchain toolkit:

PackagePurpose[amashukov/keccak-php](https://github.com/AndreyMashukov/keccak-php)Keccak-256 / SHA-3 / SHAKE hashing[amashukov/secp256k1-php](https://github.com/AndreyMashukov/secp256k1-php)secp256k1 ECDSA sign / verify / recover[amashukov/rlp-php](https://github.com/AndreyMashukov/rlp-php)Ethereum RLP encode / decode[amashukov/ton-cell-php](https://github.com/AndreyMashukov/ton-cell-php)TON TLB Cell / Builder / Slice / BOC[amashukov/abi-encoder-php](https://github.com/AndreyMashukov/abi-encoder-php)Ethereum ABI encoder[amashukov/eip1559-tx-signer-php](https://github.com/AndreyMashukov/eip1559-tx-signer-php)EIP-1559 transaction signer[amashukov/eth-rpc-client-php](https://github.com/AndreyMashukov/eth-rpc-client-php)Ethereum JSON-RPC client[amashukov/eth-php](https://github.com/AndreyMashukov/eth-php)EVM umbrella packageQuality
-------

[](#quality)

- PHPStan level 9.
- php-cs-fixer with the `@PER-CS` ruleset.
- GitHub Actions CI on every push.
- Test vectors validated against the published Keccak / SHA-3 reference outputs.

License
-------

[](#license)

MIT License.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance88

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

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

3

Last Release

62d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b3e86ca79a82515b23e0239b1d3616c747e59b64c40e169d538d5c759c9bbc4?d=identicon)[Andrey Mashukov](/maintainers/Andrey%20Mashukov)

---

Top Contributors

[![AndreyMashukov](https://avatars.githubusercontent.com/u/24682497?v=4)](https://github.com/AndreyMashukov "AndreyMashukov (5 commits)")

---

Tags

blockchaincryptographyethereumhashingkeccakkeccak-256phpsha3hashethereumkeccaksha-3sha3keccak-256

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/amashukov-keccak-php/health.svg)

```
[![Health](https://phpackages.com/badges/amashukov-keccak-php/health.svg)](https://phpackages.com/packages/amashukov-keccak-php)
```

###  Alternatives

[lastguest/murmurhash

MurmurHash3 Hash

12911.6M62](/packages/lastguest-murmurhash)[passwordlib/passwordlib

A Password Hashing Library

372223.3k7](/packages/passwordlib-passwordlib)[paragonie/password_lock

Wraps Bcrypt-SHA2 in Authenticated Encryption

19351.8k1](/packages/paragonie-password-lock)[miladrahimi/phpcrypt

Encryption, decryption, and hashing tools for PHP projects

3075.7k2](/packages/miladrahimi-phpcrypt)[ayesh/stateless-csrf

Secret-key based state-less CSRF token generator and validator for PHP 8. State-less means you do not have to store the CSRF token in session or database.

3224.5k](/packages/ayesh-stateless-csrf)[cryptapi/php-cryptapi

CryptAPI's PHP library

2214.0k](/packages/cryptapi-php-cryptapi)

PHPackages © 2026

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