PHPackages                             synchro/wordhash - 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. synchro/wordhash

ActiveLibrary[Security](/categories/security)

synchro/wordhash
================

Generate hashes in a human-readable format

v1.0.1(5y ago)11633MITPHPPHP ^7.4|^8.0

Since Oct 4Pushed 5y ago2 watchersCompare

[ Source](https://github.com/Synchro/WordHash)[ Packagist](https://packagist.org/packages/synchro/wordhash)[ GitHub Sponsors](https://github.com/Synchro)[ Patreon](https://www.patreon.com/marcusbointon)[ RSS](/packages/synchro-wordhash/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (9)Versions (3)Used By (0)

A PHP library for creating word-based hashes
============================================

[](#a-php-library-for-creating-word-based-hashes)

By Marcus Bointon ([@Synchro](https://github.com/Synchro)).

[![Test Status](https://github.com/Synchro/WordHash/workflows/Tests/badge.svg)](https://github.com/Synchro/WordHash/workflows/Tests/badge.svg)[![Type Coverage](https://camo.githubusercontent.com/162e3178b78189e239c52f24eb2d55ae339ead069eb12b45124330c7cae2f198/68747470733a2f2f73686570686572642e6465762f6769746875622f76696d656f2f7073616c6d2f636f7665726167652e7376673f)](https://camo.githubusercontent.com/162e3178b78189e239c52f24eb2d55ae339ead069eb12b45124330c7cae2f198/68747470733a2f2f73686570686572642e6465762f6769746875622f76696d656f2f7073616c6d2f636f7665726167652e7376673f)[![Total Downloads](https://camo.githubusercontent.com/a2bbeba120a2fc2ecfe88ea9e3ec0ed60bf53547ea0ce7b819ab0d183a2f1c6c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796e6368726f2f776f726468617368)](https://packagist.org/packages/synchro/wordhash)[![Latest Version](https://camo.githubusercontent.com/d20a1c459703797790404df7f84b73488342784789c7e9343689508d9f76c164/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73796e6368726f2f776f726468617368)](https://packagist.org/packages/synchro/wordhash)[![License](https://camo.githubusercontent.com/b6f392568a2d454ed2b0e384be6027e44a99af9228ec38ea1deacaaa53129ce1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73796e6368726f2f776f726468617368)](https://packagist.org/packages/synchro/wordhash)

[Hashes](https://en.wikipedia.org/wiki/Hash_function) are functions which map arbitrary-sized data into a fixed-size value. They are effectively very large numbers that are usually presented as hexadecimal (e.g. `5d41402abc4b2a76b9719d911017c592`) or base-64 strings (e.g. `XUFAKrxLKna5cZ2REBfFkg`).

While it's easy for a computer to spot differences between such random-looking strings, it's much harder for us humans. For example, it's difficult for you to tell whether `Mk3PAn3UowqTLEQfNlol6GsXPe+kuOWJSCU0cbgbcs8` and `Mk3PAn3UowqTLEQfNlo16GsXPe+kuOWJSCU0cbgbcs8` are the same simply by looking at them (they're not!). Sometimes you want a human-readable hash function that makes differences more obvious, and that's what this library provides.

This library uses a truncated SHA-512/256 hash, and maps it into words drawn from a dictionary of 4096 common English words (a random subset of [this dictionary](https://github.com/dolph/dictionary/blob/master/popular.txt)). The string `hello` produces a hash of `three-straps-solved-clutch-groove-abode`, and that's fairly easy for humans to tell apart from `three-straps-solved-lagoon-groove-abode`.

Like all good hash functions, it produces wildly different output when presented with only very small differences in the input; `hellp` produces `zlotys-south-remark-lier-rewind-accept`.

You can choose how many words it generates (up to 21, equivalent to a 252-bit hash), and what separators appear between the words. It's also possible to substitute your own dictionary.

Security warning!
=================

[](#security-warning)

This is **not** intended for high-performance or cryptographic purposes; **do not hash your passwords with this function!**

Usage
=====

[](#usage)

All methods are static, so there's no need to create an instance.

The `generate()` method takes three parameters:

- The string to hash (required)
- The number of words to use (optional, between 1 and 21, defaults to 5, the equivalent of a 45-bit hash)
- The separator to use between words (optional, defaults to `-`)

```
use Synchro\WordHash\WordHash;
echo WordHash::generate('hello!', 5, '_');
```

Example output
--------------

[](#example-output)

```
boil_rife_crepe_trait_carted

```

If you don't like the default words, or want to use emoji, HTML snippets, a different language, or something else, you can provide your own dictionary. It must contain *exactly* 4096 **unique** return-delimited words (see the provided [`dictionary.txt`](https://github.com/Synchro/WordHash/blob/main/src/dictionary.txt) for reference). The words don't need to be in any particular order, though the provided one is sorted alphabetically.

```
WordHash::loadDictionary('/path/to/my/dictionary.txt');
```

Developer info
==============

[](#developer-info)

**Requires [PHP 7.4+](https://php.net/releases/)**

🧹 Lint the code using **PHP Codesniffer**:

```
composer lint
```

⚗️ Run static analysis using **PHPStan** or **Psalm**:

```
composer test:types
composer test:psalm
```

✅ Run unit tests using **Pest**

```
composer test:unit
```

🚀 Run the entire test suite:

```
composer test
```

Project layout based on Skeleton PHP by [Nuno Maduro](https://twitter.com/enunomaduro) under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

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

Total

2

Last Release

2035d ago

PHP version history (2 changes)v1.0.0PHP ^7.4

v1.0.1PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e7028bcadbec2ee934da04d4d6232600481ac137b30b724ef116dfd55dbe9a9?d=identicon)[Synchro](/maintainers/Synchro)

---

Top Contributors

[![Synchro](https://avatars.githubusercontent.com/u/81561?v=4)](https://github.com/Synchro "Synchro (14 commits)")

---

Tags

cryptographyhacktoberfesthashphpprivacysecurityphppackagehash

###  Code Quality

TestsPest

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/synchro-wordhash/health.svg)

```
[![Health](https://phpackages.com/badges/synchro-wordhash/health.svg)](https://phpackages.com/packages/synchro-wordhash)
```

###  Alternatives

[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)[poly-crypto/poly-crypto

High-level cryptographic functions that are interoperable between NodeJS and PHP 7.1+

127.8k1](/packages/poly-crypto-poly-crypto)[pentagonal/phpass

PHP password hashing library original by open wall PhPass

121.6k](/packages/pentagonal-phpass)

PHPackages © 2026

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