Skip to content

berry.encryption.AES128Encryption

Nikos Siatras edited this page Sep 30, 2022 · 6 revisions

The AES128Encryption class provides methods to encrypt and decrypt Stings using the famous AES 128bit encyption algorithm.

Example

require_once(__DIR__ . "/berry/encryption.php"); // Include berry encryption package

$encryptionKey = "%u#bmQjfhTws&(y%"; // 16-bit encryption key
$stringToEncrypt = "Hello World!";

print "Original String: " . $stringToEncrypt."<br>";

$encryptedString = AES128Encryption::encrypt($encryptionKey,$stringToEncrypt);
print "Encrypted String: " . $encryptedString."<br>";

$descryptedString = AES128Encryption::decrypt($encryptionKey, $encryptedString);
print "Decrypted String: " . $descryptedString."<br>";
Clone this wiki locally