<commit_before>PHP Crypt
============

[![Latest Stable Version](https://poser.pugx.org/lancerhe/php-crypt/v/stable)](https://packagist.org/packages/lancerhe/php-crypt) [![Total Downloads](https://poser.pugx.org/lancerhe/php-crypt/downloads)](https://packagist.org/packages/lancerhe/php-crypt) [![Latest Unstable Version](https://poser.pugx.org/lancerhe/php-crypt/v/unstable)](https://packagist.org/packages/lancerhe/php-crypt) [![License](https://poser.pugx.org/lancerhe/php-crypt/license)](https://packagist.org/packages/lancerhe/php-crypt)

Crypt for AES, RSA, 3DES and some special algorithms.

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

**PHP5.3.0 or later**

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

Create or modify your composer.json

``` json
{
    "require": {
        "lancerhe/php-crypt": "1.1.0"
    }
}
```

Usage
-----

AES

``` php
<?php
require('./vendor/autoload.php');

$key     = 'nh9a6d2b6s6g9ynh';
$iv      = 'ddky2235gee1g3mr';
$source  = 'my message';
$crypt   = new \LancerHe\Crypt\AES();
$encrypt = $crypt->encrypt($source, $key, $iv); 
var_dump($encrypt);    // S5r5uy5zA7yTGIMj0rk68A==
$decrypt = $crypt->decrypt($encrypt, $key, $iv);
var_dump($source);     // my message
```

3DES

``` php
<?php
require('./vendor/autoload.php');

$key     = '<KEY>';
$iv      = '2235gee1';
$source  = 'my message';
$crypt   = new \LancerHe\Crypt\DES3();
$encrypt = $crypt->encrypt($source, $key, $iv); 
var_dump($encrypt);    // JPZDDBXGOXZc949A+ggNlA==
$decrypt = $crypt->decrypt($encrypt, $key, $iv);
var_dump($source);     // my message
```

RSA

``` php
<?php
require('./vendor/autoload.php');

$crypt   = new \LancerHe\Crypt\RSA('/tmp/');
$encrypt = $crypt->pubEncrypt('new message');
var_dump($encrypt);  // rand base64_encode
$decrypt = $crypt->privDecrypt($encrypt);
var_dump($decrypt);  // new message
```

Id

``` php
<?php
require('./vendor/autoload.php');

$crypt   = new \LancerHe\Crypt\Id();
$encrypt = $crypt->encrypt(23123123);
var_dump($encrypt); // w6lt46urq
$decrypt = $crypt->decrypt($encrypt);
var_dump($encrypt); // 23123123
```<commit_msg>Update Readme for 1.1.0<commit_after>PHP Crypt
============

[![Latest Stable Version](https://poser.pugx.org/lancerhe/php-crypt/v/stable)](https://packagist.org/packages/lancerhe/php-crypt) [![Total Downloads](https://poser.pugx.org/lancerhe/php-crypt/downloads)](https://packagist.org/packages/lancerhe/php-crypt) [![Latest Unstable Version](https://poser.pugx.org/lancerhe/php-crypt/v/unstable)](https://packagist.org/packages/lancerhe/php-crypt) [![License](https://poser.pugx.org/lancerhe/php-crypt/license)](https://packagist.org/packages/lancerhe/php-crypt)

Crypt for AES, RSA, 3DES and some special algorithms.

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

**PHP5.3.0 or later**

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

Create or modify your composer.json

``` json
{
    "require": {
        "lancerhe/php-crypt": "1.1.0"
    }
}
```

Usage
-----

AES

``` php
<?php
require('./vendor/autoload.php');

$key     = 'nh9a6d2b6s6g9ynh';
$iv      = 'ddky2235gee1g3mr';
$source  = 'my message';
$crypt   = new \LancerHe\Crypt\AES();
$encrypt = $crypt->encrypt($source, $key, $iv); 
var_dump($encrypt);    // S5r5uy5zA7yTGIMj0rk68A==
$decrypt = $crypt->decrypt($encrypt, $key, $iv);
var_dump($source);     // my message
```

3DES

``` php
<?php
require('./vendor/autoload.php');

$key     = '<KEY>';
$iv      = '2235gee1';
$source  = 'my message';
$crypt   = new \LancerHe\Crypt\TripleDES();
$encrypt = $crypt->encrypt($source, $key, $iv); 
var_dump($encrypt);    // JPZDDBXGOXZc949A+ggNlA==
$decrypt = $crypt->decrypt($encrypt, $key, $iv);
var_dump($source);     // my message
```

RSA

``` php
<?php
require('./vendor/autoload.php');

$crypt   = new \LancerHe\Crypt\RSA('/tmp/');
$encrypt = $crypt->pubEncrypt('new message');
var_dump($encrypt);  // rand base64_encode
$decrypt = $crypt->privDecrypt($encrypt);
var_dump($decrypt);  // new message
```

Id

``` php
<?php
require('./vendor/autoload.php');

$crypt   = new \LancerHe\Crypt\Id();
$encrypt = $crypt->encrypt(23123123);
var_dump($encrypt); // w6lt46urq
$decrypt = $crypt->decrypt($encrypt);
var_dump($encrypt); // 23123123
```
{'fraction_non_alphanumeric': 0.2241169305724726, 'fraction_numerical': 0.02825822168087698, 'mean_word_length': 4.094292803970223, 'pattern_counts': {'":': 4, '<': 13, '<?xml version=': 0, '>': 21, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6450229', 'n_tokens_mistral': 1757, 'n_tokens_neox': 1597, 'n_words': 247}