hsunmr/aes-php

PHP implementations of advanced encryption standard

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/hsunmr/aes-php

v1.0.0 2022-07-30 17:20 UTC

This package is auto-updated.

Last update: 2025-10-29 03:12:07 UTC


README

PHP implementations of advanced encryption standard

Install

composer require hsunmr/aes-php

Usage

<?php

required 'vendor/autoload.php';

use Hsunmr\AES;

// encrypt
AES::encrypt($original_string, $cipher_algo, $key, $iv);

// decrypt
AES::encrypt($encrypted_string, $cipher_algo, $key, $iv);

Example

<?php

required 'vendor/autoload.php';

use Hsunmr\AES;

$original_string = 'test';
$cipher_algo     = 'AES-256-CBC';
$key             = '0USLKHBKDQQ2T9Z7IF1GNEYJLD6ZUWGO';
$iv              = 'KGOV99FKY9O9J15H';

// encrypt
$encrypted_string = AES::encrypt($original_string, $cipher_algo, $key, $iv);
var_dump($encrypted_string); //string(24) "uwZOvY9RAtYHNzuOAZ2LuA=="

// decrypt
$result = AES::decrypt($encrypted_string, $cipher_algo, $key, $iv);
var_dump($result); //string(4) "test"