PHPackages                             xp-forge/hashing - 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. xp-forge/hashing

ActiveLibrary[Security](/categories/security)

xp-forge/hashing
================

Hashing library

v3.0.0(1y ago)012.9k↑225%BSD-3-ClausePHPPHP &gt;=7.4.0CI passing

Since Aug 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/xp-forge/hashing)[ Packagist](https://packagist.org/packages/xp-forge/hashing)[ Docs](http://xp-framework.net/)[ RSS](/packages/xp-forge-hashing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (0)

Hashing
=======

[](#hashing)

[![Build status on GitHub](https://github.com/xp-forge/hashing/workflows/Tests/badge.svg)](https://github.com/xp-forge/hashing/actions)[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)[![Requires PHP 7.4+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_4plus.svg)](http://php.net/)[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)[![Latest Stable Version](https://camo.githubusercontent.com/f9087204acba96c08f52ddcc89b8b7f0b86c4800f4ce17550e87ed598f6f8517/68747470733a2f2f706f7365722e707567782e6f72672f78702d666f7267652f68617368696e672f76657273696f6e2e737667)](https://packagist.org/packages/xp-forge/hashing)

Fluent interface to hashing functions provided by PHP, extended with Murmur3.

Examples
--------

[](#examples)

Calculate hash for a string, output using base32:

```
use text\hash\Hashing;

$hash= Hashing::murmur3_32()->new($seed= 0x2a);
$base32= $hash->digest('The quick brown fox jumps over the lazy dog.')->base32();
```

Incrementally updating hash, output hex (much like the builtin `md5()` function does):

```
use text\hash\Hashing;

$hash= Hashing::md5()->new();
while ($stream->available()) {
  $hash->update($stream->read());
}

$hex= $hash->digest()->hex();
```

Comparing hashes using constant time comparison:

```
use text\hash\{Hashing, HashCode};

$computed= Hashing::sha256()->digest($req->param('password')); // From request
$stored= HashCode::fromHex($record['password_hash']);          // From database

if ($computed->equals($stored)) {
  // Not susceptible to timing attacks
}
```

Algorithms
----------

[](#algorithms)

The following algorithms exist as shortcuts inside the entry point class:

- `Hashing::md5()`
- `Hashing::sha1()`
- `Hashing::sha256()`
- `Hashing::sha512()`
- `Hashing::murmur3_32()`
- `Hashing::murmur3_128()`

[Other algorithms](https://www.php.net/manual/en/function.hash-algos.php) can be instantiated via `Hashing::algorithm(string $name, var... $args)`, which may raise an *IllegalArgumentException* if the given algorithm is not available.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance48

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

Established project with proven stability

 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 ~204 days

Recently: every ~290 days

Total

13

Last Release

379d ago

Major Versions

v0.2.0 → v1.0.02019-08-21

v1.0.1 → v2.0.02019-12-01

v2.3.0 → v3.0.02025-05-04

PHP version history (3 changes)v0.1.0PHP &gt;=5.6.0

v2.0.0PHP &gt;=7.0.0

v3.0.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/07d18d882c8b4aaf3466432f64018214f2771eda333202175431ee7233795376?d=identicon)[thekid](/maintainers/thekid)

---

Top Contributors

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

---

Tags

hashingmd5murmur3php7php8sha1sha256sha512xp-frameworkmodulexp

### Embed Badge

![Health badge](/badges/xp-forge-hashing/health.svg)

```
[![Health](https://phpackages.com/badges/xp-forge-hashing/health.svg)](https://phpackages.com/packages/xp-forge-hashing)
```

###  Alternatives

[exadium/silverstripe-invisible-spam-protection

Very simple anti spam protection based on principle that automated spammers enter bogus information in all form fields. Field is added to form that is hidden using CSS hiding it from human users. Form is only allowed to be submitted if field is empty. Includes an EditableInvisibleSpamField to integrate with the UserForms module.

112.1k](/packages/exadium-silverstripe-invisible-spam-protection)

PHPackages © 2026

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