PHPackages                             kangyasin/crypt-aes-php - 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. kangyasin/crypt-aes-php

ActiveLibrary[Security](/categories/security)

kangyasin/crypt-aes-php
=======================

A library to encrypt or decrypt with random password generator based on secret key defined.

03PHP

Since Nov 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/kangyasin/crypt-aes-php)[ Packagist](https://packagist.org/packages/kangyasin/crypt-aes-php)[ RSS](/packages/kangyasin-crypt-aes-php/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

CryptAES (PHP)
==============

[](#cryptaes-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bad396de5d33e607e4ce9a8305d48f52268c72e085bed75d05113a31d1a5a6cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b616e67796173696e2f63727970742d6165732d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kangyasin/crypt-aes-php)[![Total Downloads](https://camo.githubusercontent.com/ff86acab9198b753aa17f720b0efd6820ebf53200ba08523f4f7672f73b854e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b616e67796173696e2f63727970742d6165732d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kangyasin/crypt-aes-php)[![License](https://camo.githubusercontent.com/f9f84796ab99e605d28ac65a683139f88447f8fd1400f2b25ca3b4239086381d/68747470733a2f2f706f7365722e707567782e6f72672f6b616e67796173696e2f63727970742d6165732d7068702f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/kangyasin/crypt-aes-php)

This is the library for encrypting data with a key (password will be generate as per your parameters set) in PHP.

**WHY ANOTHER LIBRARY?** This was intended to developed for cross-platform AES Encryption [here](https://github.com/kangyasin/AES-CrossPlatform) as PHP was missing. My main objective is to create library for `AES-256-CBC` to contribute PHP package for Cross-Platform-AES package, more features will be added whenever I gets time.

### Features

[](#features)

- Support for Random IV (initialization vector) for encryption and decryption. Randomization is crucial for encryption schemes to achieve semantic security, a property whereby repeated usage of the scheme under the same key does not allow an attacker to infer relationships between segments of the encrypted message.
- Support for SHA-256 for hashing the key. Never use plain text as encryption key. Always hash the plain text key and then use for encryption. AES permits the use of 256-bit keys. Breaking a symmetric 256-bit key by brute force requires 2^128 times more computational power than a 128-bit key. A device that could check a billion billion (10^18) AES keys per second would in theory require about 3×10^51 years to exhaust the 256-bit key space.
- PHP-7 Support since `mcrypt` has been deprecated.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require kangyasin/crypt-aes-php
```

Dependencies
------------

[](#dependencies)

The bindings require the following extensions in order to work properly:

- [`openssl`](https://secure.php.net/manual/en/book.openssl.php)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

Usage
-----

[](#usage)

#### With Random IV

[](#with-random-iv)

```
$string     = 'The quick brown fox jumps over to the lazy dog.';
$secretyKey = 'BlVssQKxzAHFAUNZbqvwS+yKw/m';

$encryption = new \Kangyasin\CryptAES\CryptAES();

$cipher  = $encryption->encryptPlainTextWithRandomIV($string, $secretyKey);
echo 'Cipher: ' . $cipher . PHP_EOL;

$plainText = $encryption->decryptCipherTextWithRandomIV($cipher, $secretyKey);
echo 'Decrypted: ' . $plainText . PHP_EOL;
```

#### With Generated IV

[](#with-generated-iv)

```
$string     = 'The quick brown fox jumps over to the lazy dog.';
$secretyKey = 'BlVssQKxzAHFAUNZbqvwS+yKw/m';

$encryption = new \Kangyasin\CryptAES\CryptAES();
$iv         = $encryption->generateRandomIV();

$cipher = $encryption->encrypt($string, $secretyKey, $iv);
echo 'Cipher: ' . $cipher . PHP_EOL;

$plainText = $encryption->decrypt($cipher, $secretyKey, $iv);
echo 'Decrypted: ' . $plainText . PHP_EOL;
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 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/f27d8c7aa02ab1a94bb0c1c172a3159d3d203cd0d19c7042f1747b05b755534d?d=identicon)[kangyasin](/maintainers/kangyasin)

---

Top Contributors

[![kangyasin](https://avatars.githubusercontent.com/u/31263789?v=4)](https://github.com/kangyasin "kangyasin (2 commits)")

### Embed Badge

![Health badge](/badges/kangyasin-crypt-aes-php/health.svg)

```
[![Health](https://phpackages.com/badges/kangyasin-crypt-aes-php/health.svg)](https://phpackages.com/packages/kangyasin-crypt-aes-php)
```

###  Alternatives

[mews/purifier

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

2.0k18.7M143](/packages/mews-purifier)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24820.0k37](/packages/paragonie-ecc)

PHPackages © 2026

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