PHPackages                             openlss/lib-crypt - 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. openlss/lib-crypt

ActiveLibrary[Security](/categories/security)

openlss/lib-crypt
=================

Shorthand library for using AES encryption provided by PHP-Mcrypt

0.0.10(13y ago)447.0k↓22.6%21LGPL-3.0+PHPPHP &gt;=5.3.2

Since Mar 23Pushed 13y ago2 watchersCompare

[ Source](https://github.com/nullivex/lib-crypt)[ Packagist](https://packagist.org/packages/openlss/lib-crypt)[ Docs](http://openlss.org)[ RSS](/packages/openlss-lib-crypt/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (12)Used By (1)

lib-crypt
=========

[](#lib-crypt)

Shorthand library for using AES encryption provided by PHP-Mcrypt

Usage
-----

[](#usage)

```
use \LSS\Crypt;

//create keys
$iv_key = Crypt::IVCreate();
$crypt_key = Crypt::keyCreate();

$crypt = Crypt::_get($crypt_key,$iv_key);
$crypted_str = $crypt->encrypt('my string'); //returns base64 encoded crypted string
$var = $crypt->decrypt($crypted_str); //returns 'my string'
```

Padding
-------

[](#padding)

By default MCrypt will NULL-PAD strings to get the proper encryption. However this creates problems when expecting exact payload encryption (such as binary)

Crypt deals with this by storing the size of the payload as the first 4 bytes in the returned string Crypt then extracts this size and trims the payload to the original size upon decrypt

The downside to this is that it cant be decrypted by the regular MCrypt functions without first stripping the initial 4 bytes. It would be recommended to trim the payload if possible

Reference
---------

[](#reference)

### (string) Crypt::IVCreate()

[](#string-cryptivcreate)

Returns a proper initialization vector for the encryption type

### (string) Crypt::keyCreate()

[](#string-cryptkeycreate)

Returns a proper secret key for the encryption type

### (object) Crypt::\_get($key,$iv)

[](#object-crypt_getkeyiv)

Shorthand for the construct that returns the new object

### (object) Crypt::setKey($key)

[](#object-cryptsetkeykey)

Change the key at runtime Returns $this so its chainable

### (object) Crypt::setIV($iv)

[](#object-cryptsetiviv)

Change the IV at runtime Returns $this so its chainable

### (object) Crypt::verify()

[](#object-cryptverify)

Verifies the key and IV Will throw exceptions on errors Returns $this so its chainable

### (string) Crypt::encrypt($plain\_string,$base64\_encode=true)

[](#string-cryptencryptplain_stringbase64_encodetrue)

- $plain\_string String to be encrypted
- $base64\_encode TRUE to base64\_encode the encrypted string Returns the encrypted and optionally base64\_encoded string

### (string) Crypt::decrypt($enc\_string,$base64\_decode=true)

[](#string-cryptdecryptenc_stringbase64_decodetrue)

- $enc\_string The encrypted string to be decrypted
- $base64\_decode If the $enc\_string is base64\_encoded set to TRUE Returns the EXACT original string

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96% 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 ~2 days

Total

10

Last Release

4779d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/83c8e9d55e3ebafb0621a441a51af8f551f61a274fde5400459a29cc320b7b75?d=identicon)[nullivex](/maintainers/nullivex)

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

---

Top Contributors

[![nullivex](https://avatars.githubusercontent.com/u/2321375?v=4)](https://github.com/nullivex "nullivex (24 commits)")[![doyjo](https://avatars.githubusercontent.com/u/3947855?v=4)](https://github.com/doyjo "doyjo (1 commits)")

---

Tags

encryptionaesmcryptdecryption

### Embed Badge

![Health badge](/badges/openlss-lib-crypt/health.svg)

```
[![Health](https://phpackages.com/badges/openlss-lib-crypt/health.svg)](https://phpackages.com/packages/openlss-lib-crypt)
```

###  Alternatives

[phpseclib/phpseclib

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

5.6k434.8M1.3k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[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)[mmeyer2k/dcrypt

A petite library of encryption functionality for PHP

98727.2k1](/packages/mmeyer2k-dcrypt)[chuyskywalker/phpaes

PHP AES -- Accurate &amp; Fast AES in PHP

356.1k](/packages/chuyskywalker-phpaes)[camcima/dukpt-php

DUKPT implementation in PHP

25153.1k](/packages/camcima-dukpt-php)

PHPackages © 2026

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