PHP code example of akimimi / encrypt

1. Go to this page and download the library: Download akimimi/encrypt library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

akimimi / encrypt example snippets



use Akimimi\Encrypt\AesEcbEncrypt;

$password = "123456";
$data = "akimimi";

$encryptUtil = new AesEcbEncrypt(16); // 128 bit
$encryptUtil->setPassword($password);
$encryptedStr = $encryptUtil->encrypt($data); // 0x2582ec23698d74912c044ef3e29ac86b


use Akimimi\Encrypt\AesEcbEncrypt;
use Akimimi\Encrypt\Base64Encoder;

$password = "123456";
$data = "akimimi";

$encryptUtil = new AesEcbEncrypt(16); // 128 bit
$encryptUtil->setBytesEncoder(new Base64Encoder());
$encryptUtil->setPassword($password);
$encryptedStr = $encryptUtil->encrypt($data); // JYLsI2mNdJEsBE7z4prIaw==
$decryptedStr = $encryptUtil->decrypt($encryptedStr); // akimimi