Reputation: 188
I'm attempting to use this encryption system with PHP.
It comes with this code from the download.
$salt = 'nala321';
$password = 'Alan';
include('./crypt/Crypt/AES.php');
$aes = new Crypt_AES();
$aes->setKey('abcdefghijklmn');
$size = 10 * 1024;
***EDIT***
$plaintext = $password.$salt;
***EDIT***
for ($i = 0; $i < $size; $i++) {
$plaintext.= 'a';
}
$enc = $aes->encrypt($plaintext);
echo $enc;
This results in a very long output. How do I go about storing this into mysql? I've looked at different ideas saying to do
EDIT
It returns characters like this
¸ÂØwÕ·›óöŽfjËëªû ÒÚCÂF I3T{öËY_Œ:4$¯Ÿ´
EDIT
VARCHAR(16) CHARSET ascii COLLATE ascii_bin
Which is for an md5 encryption password. I'm not sure if I should put down the size to
$size = (16*16)-1; // for 255 limit on varchar
Thanks for the comments to come!
Upvotes: 1
Views: 1193
Reputation: 188
I took out the for loop entirely.
Stored the password as just a varchar(30) and it works just fine.
The final codes looks like this
$password = 'Alan';
include('./crypt/Crypt/AES.php');
$aes = new Crypt_AES();
$aes->setKey('abcdefghijklmn');
$enc = $aes->encrypt($plaintext);
echo $enc;
Upvotes: 1