PHPackages                             michaelmawhinney/cryptex - 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. michaelmawhinney/cryptex

ActiveLibrary[Security](/categories/security)

michaelmawhinney/cryptex
========================

A simple PHP class for 2-way authenticated encryption using XChaCha20 + Poly1305 (libsodium)

v5.0.0(5d ago)3263[16 issues](https://github.com/michaelmawhinney/Cryptex/issues)MITPHPPHP &gt;=8.3CI passing

Since Feb 2Pushed 5d ago1 watchersCompare

[ Source](https://github.com/michaelmawhinney/Cryptex)[ Packagist](https://packagist.org/packages/michaelmawhinney/cryptex)[ Docs](https://github.com/michaelmawhinney/cryptex)[ RSS](/packages/michaelmawhinney-cryptex/feed)WikiDiscussions main Synced yesterday

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

[![](https://camo.githubusercontent.com/935ca6932a502792f1b65c7249988adace3872e65577ff76e9985e339000cab6/68747470733a2f2f6d69636861656c6d617768696e6e65792e636f6d2f637279707465782f6c6f676f2e676966)](https://camo.githubusercontent.com/935ca6932a502792f1b65c7249988adace3872e65577ff76e9985e339000cab6/68747470733a2f2f6d69636861656c6d617768696e6e65792e636f6d2f637279707465782f6c6f676f2e676966)

Cryptex: 2-way Authenticated Encryption Class
=============================================

[](#cryptex-2-way-authenticated-encryption-class)

Cryptex is a simple PHP class that performs 2-way authenticated encryption using XChaCha20 + Poly1305.

Version 5.0.0 is a modernization and hardening release. It keeps the v4 public API, the v4 hex ciphertext format, and external salt semantics intact.

Requirements
============

[](#requirements)

- PHP 8.3 or newer
- `ext-sodium`

These requirements apply to v5.0.0 and later. Existing v4-style ciphertexts remain decryptable with the same API, but v5 does not introduce a new ciphertext envelope or transport encoding.

Installation
============

[](#installation)

The preferred method of installation is with Packagist and Composer. The following command installs the package and adds it as a requirement to your project's composer.json:

`composer require michaelmawhinney/cryptex`

You can also download or clone the repo and include the `src/Cryptex.php` manually if you prefer.

Usage
=====

[](#usage)

**Always store or transmit your `$key` and `$salt` values securely.**

```
