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

AbandonedArchivedLibrary[Security](/categories/security)

leigh/chacha20
==============

Pure PHP implementation of the ChaCha20 encryption algorithm.

0.2.0(10y ago)188.3k↓100%3MITPHPPHP &gt;=7.0

Since Dec 14Pushed 5y ago3 watchersCompare

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

READMEChangelogDependencies (1)Versions (4)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

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity50

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

Total

3

Last Release

3768d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.4

0.2.0PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec51e6a7e4e13915e229d77557ea2495f9f2d3992166e687c828be17e307a478?d=identicon)[lt](/maintainers/lt)

---

Top Contributors

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

---

Tags

streamsecurityencryptioncipher

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M212](/packages/defuse-php-encryption)[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.6k434.8M1.3k](/packages/phpseclib-phpseclib)[ass/xmlsecurity

The XmlSecurity library is written in PHP for working with XML Encryption and Signatures

955.6M30](/packages/ass-xmlsecurity)[nzo/url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

961.0M2](/packages/nzo-url-encryptor-bundle)[tilleuls/url-signer-bundle

Create and validate signed URLs with a limited lifetime in Symfony

81340.1k](/packages/tilleuls-url-signer-bundle)[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

642.6k](/packages/ercsctt-laravel-file-encryption)

PHPackages © 2026

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