PHPackages                             limb-php/chacha20 - 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. limb-php/chacha20

ActiveLibrary[Security](/categories/security)

limb-php/chacha20
=================

Pure PHP implementation of the ChaCha20 encryption algorithm.

01PHP

Since Mar 3Pushed 2mo agoCompare

[ Source](https://github.com/limb-php/PHP-ChaCha20)[ Packagist](https://packagist.org/packages/limb-php/chacha20)[ RSS](/packages/limb-php-chacha20/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ChaCha20 in PHP
===============

[](#chacha20-in-php)

This library contains a pure PHP implementation of the ChaCha20 encryption algorithm.

The library has been written to be high performance (relative to PHP), not pretty. It obviously doesn't perform anywhere close to a native implementation.

### Usage:

[](#usage)

Remember that *a nonce must not be used more than once for a particular key*

```
$chacha20 = new ChaCha20\Cipher;
$encCtx = $chacha20->init($key, $nonce);
$decCtx = $chacha20->init($key, $nonce);

$cipherText = $chacha20->encrypt($encCtx, $message);
$plainText = $chacha20->decrypt($decCtx, $cipherText);

```

The `Context` object maintains the current state of the algorithm, so that it can be used in a streaming scenario. Therefore an application performing simultaneous encryption and decryption will need to main two contexts.

The `decrypt` method is an alias of the `encrypt` method, and exists only to indicate intent.

Seek operations can be performed on the keystream by calling the `setCounter` method, where the count is in 64-byte blocks.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance56

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 94.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/78afb8404330170e30bb86cfbd8018b28359ea61cd8d161a3a6e09b274a8a4f5?d=identicon)[xadminx](/maintainers/xadminx)

---

Top Contributors

[![lt](https://avatars.githubusercontent.com/u/1503065?v=4)](https://github.com/lt "lt (18 commits)")[![xadminx](https://avatars.githubusercontent.com/u/399028?v=4)](https://github.com/xadminx "xadminx (1 commits)")

### Embed Badge

![Health badge](/badges/limb-php-chacha20/health.svg)

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41478.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

87117.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)[paragonie/hidden-string

Encapsulate strings in an object to hide them from stack traces

7410.6M39](/packages/paragonie-hidden-string)

PHPackages © 2026

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