Can MD5 be encrypted multiple times and is it reversible?

MD5 is a one-way hashing algorithm, meaning it is not designed to be reversible. Therefore, encrypting MD5 multiple times will not change the original hash value, and it cannot be decrypted back to the original input. If multiple levels of encryption are needed, it is recommended to use a more secure hashing algorithm like SHA-256.

$input = "password123";
$hash = md5($input);

echo "Original MD5 hash: " . $hash . "\n";

// Encrypting MD5 multiple times
$hash2 = md5($hash);
$hash3 = md5($hash2);

echo "MD5 hash encrypted twice: " . $hash2 . "\n";
echo "MD5 hash encrypted three times: " . $hash3 . "\n";