I'm going to preface this by saying I have absolutely no clue when it comes to cryptography, but I'm posting this question because I'm very interested and I have no doubt there are some smart people on here who will be able to explain this to me like I'm 5.
So to my understanding md5 is considered insecure because of how quickly things can be hashed, which means brute force attacks are very easy and attackers could even compare a hashed md5 password against a pre-generated table.
Which is why when (using php) I compute md5("password");
and it gives me 5f4dcc3b5aa765d61d8327deb882cf99
I can plug that value in to a site like this and in 45ms it spits back 5f4dcc3b5aa765d61d8327deb882cf99 MD5 : password
But what if I add some "helper" data to the beginning and end of my password?
<?php
$helper = "Qw3r7y1uioP[4]AsdfGh5jkl3'z7xcvb9nm,.?";
echo md5($helper."password".$helper);
?>
It returns 9f1f60fc8d76caa77b11810a0d68e0c5
(which the same site can't decrypt, though I'm not sure if rainbow tables could, seems unlikely though right?) which I could then store, along with the "helper" to compare to future password sent by post:
<?php
$helper = "Qw3r7y1uioP[4]AsdfGh5jkl3'z7xcvb9nm,.?";
$accepted = "9f1f60fc8d76caa77b11810a0d68e0c5";
$pass = $_POST["password"];
if (md5($helper.$pass.$helper)==$accepted) {
echo "Password was correct.";
} else {
echo "Password was incorrect.";
}
?>
What is wrong with this approach? I'm sure there is some reason that it isn't a good idea, I just don't have enough understanding of how md5 and cryptography in general works to pinpoint why.