AES 128 En and Decryption Library for PHP


I'm going to make the page prettier soon!

How to use the extention:

1.) Download the extention. (PHP 5.5 and up) 1.1) Download the PHP 5.3 compatible extention. (PHP 5.3 and up)
1.2) Download the example Programm! (new)
2.) Rename all downloaded files from: AESLib.php.txt to: AESLib.php | AESLibc.php.txt to AESLibc.php | AESLibExample.php.txt to AESLibExample.php.
3.) Include the file with the command include("AESLib.php"); or require("AESLib.php"); .

The Library has 3 Funktions same as the extention of e.g. Taifun's extention.

   1. AES_Salt(); This function generates a Salt wich is used for the encryption. The php server and the Android application has to have the same Salt! Otherwise it wont work..

   2. AES_Encrypt($password,$salt,$text_to_encrypt); This function takes a normal text (You can find other Idears here (added soon!)), a password and the salt from the function above and encrypts it.

   3. AES_Decrypt($password,$salt,$text_to_decrypt); This function takes the encrypted text and decrypts it, it uses the same password and the same salt as above, obviously ;).

(Don't forget to activate the openssl module on your webserver. On xampp it is enabled by default, but if you are using a nas or some other type of server, then you might need to enable it.
If it's not enabled you will relize it pretty fast trust me! :D)

I think thats all you need to use this library have fun and don't let your data unencrypted!!
I tried to make it as simple as possible to implement as I could. If you have any Question feel free to write me a message at !

If you want to use my code in any application go for it! But be so kind and link the page on your webside, if you want to explain my code or make it available in any form!

Created: 02.10.2019
Updated: 04.03.2020
Updated: 21.10.2022