I was looking at mcrypt documentation and one of the examples was the following:
$key = pack('H*', "bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3");
$key_size = strlen($key);
echo "Key size: " . $key_size . "\n";
Given I have to use either 16, 24 or 32 byte keys for AES-128, 192 and 256 respectively, is it a good practice using a 32-byte key for 128-bit encryption? If not, why?
Second question is related to that of using a random key each time. Would it be possible for something like that to actually work out since afterwards I wouln't know which key was used to encrypt the string hence making it impossible to decrypt?
I just want to make it secure and am not quite sure whether key randomness is a possible approach.