PHPackages                             cheich/cryptonite - 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. cheich/cryptonite

AbandonedArchivedLibrary[Security](/categories/security)

cheich/cryptonite
=================

Encryption and password hashing

0142PHP

Since Sep 22Pushed 8y ago1 watchersCompare

[ Source](https://github.com/cheich/Cryptonite)[ Packagist](https://packagist.org/packages/cheich/cryptonite)[ RSS](/packages/cheich-cryptonite/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Cryptonite - the hacker's kryptonite
====================================

[](#cryptonite---the-hackers-kryptonite)

Features
--------

[](#features)

- Asymmetric encryption
- Symmetric encryption
- Password hashing

Install
-------

[](#install)

### Composer

[](#composer)

#### Command Line

[](#command-line)

```
composer require cheich/cryptonite

```

#### composer.json

[](#composerjson)

```
{
  "require": {
    "cheich/cryptonite": "dev-master"
  }
}

```

Requirements
------------

[](#requirements)

- PHP &gt;= 5.3.3
- OpenSSL &gt;= 0.9.6 - Should not between 1.0.1 and 1.0.1f (prevent Heardbleed exploits, see )
- Place minimalistic `openssl.cnf` file near `Cryptonite.php` as fall-back

Examples
--------

[](#examples)

### Symmetric encryption

[](#symmetric-encryption)

#### Encrypt data

[](#encrypt-data)

```
try {
  $symmetric = new SymmetricEncryption();
  $encrypted = $symmetric->encrypt('String to encrypt', 'MyPassphrase');
  $iv        = $symmetric->getInitVector();
} catch (EncryptionException $e) {
  echo "Something went wrong...";
}
```

#### Decrypt data

[](#decrypt-data)

```
try {
  $symmetric = new SymmetricEncryption();
  $encrypted = /* get encrypted data from database */;
  $iv        = /* get iv from database */;

  $decrypted = $symmetric->decrypt($encrypted, 'MyPassphrase', $iv);
} catch (EncryptionException $e) {
  echo "Something went wrong...";
}
```

### Asymetric encryption

[](#asymetric-encryption)

#### Generate private/public key pair

[](#generate-privatepublic-key-pair)

```
try {
  $asymmetric = new AsymmetricEncryption();
  $publicKey  = $asymmetric->getPublicKey(); // or export to a file
  $privateKey = $asymmetric->getPrivateKey('MyPassphrase'); // or export to a file
  $encrypted  = $asymmetric->encrypt('String to encrypt', $publicKey);
} catch (EncryptionException $e) {
  echo "Something went wrong...";
}
```

#### Decrypt with private key

[](#decrypt-with-private-key)

```
try {
  $asymmetric = new AsymmetricEncryption();
  $privateKey = /* get private key */;
  $encrypted  = /* get encrypted data */;

  $decrypted = $asymmetric->decrypt($encrypted, $privateKey, 'MyPassphrase');
} catch (EncryptionException $e) {
  echo "Something went wrong...";
}
```

### Passwords

[](#passwords)

#### Hash password

[](#hash-password)

```
try {
  $password = new Password();
  $hashed   = $password->hash('MyPassphrase');
} catch (EncryptionException $e) {
  echo "Something went wrong...";
}
```

#### Verify password

[](#verify-password)

```
try {
  $password = new Password();
  $hashed   = /* get hashed password */;

  // Returns true or false
  $password->verify('MyPassphrase', $hashed);
} catch (EncryptionException $e) {
  echo "Something went wrong...";
}
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![cheich](https://avatars.githubusercontent.com/u/5952533?v=4)](https://github.com/cheich "cheich (11 commits)")

---

Tags

asymmetricencryptionhashpasswordsymmetric

### Embed Badge

![Health badge](/badges/cheich-cryptonite/health.svg)

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[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

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

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

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

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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