I would like to know in the following code if PKCS#5 padding is added ? If not how to add ?
$message = \"insert plaintext message here\";
$iv = pack(\'H*\'
No, it is not added. Unfortunately PHP / mcrypt uses zero padding until the message is N times the block size.
To add PKCS#5 padding, use the formula:
p = b - l % b
Where l is the message length, b is the block size and % is the remainder operation. Then add p bytes with the value p to the end before performing the encryption.